Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

displaying XML formatted by XSL in JSP

 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic