[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] XSLT Saxon Transformation in JSP pages ?


Subject: [xsl] XSLT Saxon Transformation in JSP pages ?
From: "Vincent Blondel" <vincent@xxxxxxxxxxxx>
Date: Mon, 4 Sep 2006 11:49:21 +0200 (CEST)

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


Current Thread
Keywords