• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

.. XML transformation ..

 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to transform XML into a JSP.Where exactly XSL fits into.Is it good idea to transform into JSP.I know getting XML is of no use unless u display in browser with creative visuality.
 
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what you mean by no visual appearence, you must have not made a dtd.
------------------
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work
 
Brett Knapik
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as converting it to JSP, I don't see a reason why not if thats what you really want.
------------------
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Brett Knapik:
I don't know what you mean by no visual appearence, you must have not made a dtd.


XML is just a way to represent data. It has no visual appearance even with a DTD. (MSIE has a built-in stylesheet that gives you a collapsable tree view of an XML file, don't let that distract you from the point).
What Anil Vupputuri refers to is probably the use of XML and stylesheets to render HTML (or WML or...) output.
Your JSP generates not HTML, but an XML file. This file purely represents the data you want to display, without any information about the way you want to display it. It is fed into an XSLT processor, which applies the stylesheet to the XML file to produce your formatted output.
The stylesheet basically contains instructions that match (chunks of) XML data and tell the processor what output to generate for every match. This output can be anything -- XML, HTML, WML, or (using XSL Formatting Objects) even .pdf or any other format.
This explanation is probably too terse to be useful. For a very good article about XML/XSL and servlets, see http://www.onjava.com/pub/a/onjava/2000/12/15/xslt_servlets.html
- Peter
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anil,
You can use XSL with XML to reformat the XML to whatever you want, HTML, new XML or plan text (i.e code) for example. By using XSL, you dont need any server-side functionality (except from the XSL transformation in itself) as JSP for reformatting your data.
JSP will probably be handy for other purposes of your application, general server-side logic. Why do you want to generate JSP pages from XML, it is probably a complicated task, but not impossible...
Hope that was to some help,
Marius
[This message has been edited by Marius Holm (edited January 23, 2001).]
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generating JSP from XML is directly supported in the Resin web server (from http://www.caucho.com/ . It serves the useful purpose of allowing you to put "look and feel" code in a stylesheet which can be applied to many pages automatically.
The process goes something like this:
0. Stylesheet author builds XSLT stylesheet for site look and feel, webserver compiles it into a Java class.
1. Content Author writes simple XML marked-up content with no look-and feel.
2. Content Author places XML content on web server.
3. Web server detects the new file and applies the compiled stylesheet to build a JSP file.
4. Web server compiles the JSP into a servlet, then a Java class file.
5. Web server runs the compiled servlet class file for each request.
The advantage of using JSP rather than just transforming XML to static HTML is that you then have all of the power of JSP available in your look-and-feel code and can do things like alter the appearance at run time based on the user's stored preferences.
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marius Holm & Frank Carver,
u got me correct.Thanks to u and Peter den Haan for ur responses.
Actually iam getting an XML file, which has to be formatted at web-layer using some java code with jsp and also has to produce "look-n-feel" using XSLT stylesheet. here i have been finding some difficulty while communicating XSLT with JSP(i.e., java code) like sorting and generating dynamic XSLT style sheets
according to user responses.Is there any good stuff regarding dynamic XSLT. and also is there any way to communicate Javascript with XSLT.

Thanx.
Anil

[This message has been edited by Anil Vupputuri (edited January 25, 2001).]
[This message has been edited by Anil Vupputuri (edited January 25, 2001).]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!