XSLT Saxon Transformation in JSP pages ?
Hello, I am a complete newbie with JSP and XSLT Saxon technologies but I am interested to mix all these together. I am trying to find an easy way to make xslt transformation (from files) in my JSP pages through XSLT engine. Below is an example the way I am currently doing it but I don't find this is so easy nor this is so elegant. Furthermore, if I create a Tomcat web application with eclipse and creates this simple index.jsp page this is working fine without adding any jar files in WEB-INF/lib directory. So my questions are : * How can this work without any jar file ( saxon.jar ) in my web application, is this comimng from jdk ( 1.5.0_06 ) himself ? * How can I integrate my XSLT transformation with saxon exngine ? * Is there a way to make this easier , with special Jsp Saxon tags ? --- index.jsp --- <%@ page contentType="text/html" import="javax.xml.parsers.*, org.w3c.dom.*, javax.xml.transform.*, javax.xml.transform.stream.*, java.io.*" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Title</title> </head> <body> <% StreamSource xml = new StreamSource(new File("c:/temp/hello.xml")); StreamSource xsl = new StreamSource(new File("c:/temp/hello.xsl")); StreamResult result = new StreamResult(out); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(xsl); transformer.transform(xml, result); %> </body> </html> Regards Vincent
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format