This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xsl or not xsl?

 
aude tantot
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've heard that through java, i can display an xml doc in my browser without using xsl, is that true?
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The browser will display the XML document as is. If you need to extract parts of the document and format them in a different order you will need to use XSL. Infact the browser uses a dummy XSL that simply traverses all the nodes and prints the contents.
The capability of a browser to display an XML document should not be considered as an alternative to using XSLs. For example, a browser is of no use if you have to generate the formatted XML, say in the pdf format or MSWord format on the server!
HTH
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Audi,
Do you mean to parse the xml document with parser? and using DOM/SAX to traverse through them?
I am not sure if I am right in saying this..
 
aude tantot
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in fact, i generate, xml thru java and i would like to display it in a pretty look in my browser, i know i can do that with xsl, but i've heard i can do so without it directly thru java (what i feel incredible, that's why i ask if that's true)
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can use "on-the-fly" transformation using any standard XSLT engine. For example, checkout the XALAN API form Apache. Using the Transformer class and a stylesheet, you can easily generate the output (HTML/TXT/any other format) file.
HTH
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic