Friday 6 July 2007

Setting up the Saxon Servlet

I found very little documentation on how to do implement the Saxon Servlet and get it working - so here goes.
1. Install Tomcat - I have Tomcat v6 already installed. It was the basic installation.
2. in webapps add a directory called xslt
copy the files to the following locations:
xslt
  |
  WEB-INF
      web.xml
    |
    classes
      SaxonServlet.class
    |
    lib
      Saxon8.jar + other saxon jars

web.xml consists of the following lines:
<web-app>
<display-name>Saxon Servlet Example</display-name>
<description>
Saxon Servlet Example
</description>
<servlet>
<servlet-name>SaxonServlet</servlet-name>
<servlet-class>SaxonServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SaxonServlet</servlet-name>
<url-pattern>/SaxonServlet</url-pattern>
</servlet-mapping>
</web-app>


then use the following url to calls the transformation:
http://localhost:8080/xslt/SaxonServlet?source=books.xml&style=books.xsl

and to clear the stylesheet cache:
http://localhost:8080/xslt/SaxonServlet?clear-stylesheet-cache=yes

No comments:

Post a Comment