wood burning stoves 2.0*
The moose likes JSP and the fly likes displaying XML formatted by XSL in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "displaying XML formatted by XSL in JSP" Watch "displaying XML formatted by XSL in JSP" New topic
Author

displaying XML formatted by XSL in JSP

Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

OK-- So I've written an app that allows you to view files that have been assigned to a particular case.

So, long story short, I need to display the content of an XML file. Currently I'm just using <pre> tags to surround the XML, but the powers that be would like to have the XML displayed all pretty-like using an XSL that someone wrote.

The question is -- how do I display an XML file with the XSL formatting in a JSP? (I've gotta use the JSP 'cause there's other stuff going on on the page -- header / left menu / footer, that kind of thing.

Thanks for any help!


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

Hmm, not something I've done a lot with. To "embed" the XSL output with surrounding JSP perhaps a <jsp:include> for the XSL URL?

Or, would it be easier to dump the XSL and use the JSTL 'x' tags on the JSP page?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Jessica Sant:


The question is -- how do I display an XML file with the XSL formatting in a JSP? (I've gotta use the JSP 'cause there's other stuff going on on the page -- header / left menu / footer, that kind of thing.

Thanks for any help!


Actually you feed your XML and XSL to the XALAN, and then take the output of xalan to jsp printwriter..
Dont have the working code right now, as i am not near to MY PC, but you can try to modify the servlet example from xalan package (there is a sample servlet java code available)..


Will it solve the problem ?


Spritle Software Blogs
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

thanks folks -- I think this example from Xalan's site will be the ticket: http://xml.apache.org/xalan-j/samples.html#jspsample

much appreciated!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: displaying XML formatted by XSL in JSP
 
Similar Threads
JSP for transforming XML using XSL
Use different XSL files on the same XML doc
creating pdf,xml,doc file using servlet
Advise on Model
jsp or xsl