7.1 XSLT processor as servlet
7.1.1 Saxon servlet
A Java class written specifically to be run on a web server is called a servlet . A software layer that works as an interface between the actual web server (such as Apache) and Java servlets is called a servlet container or servlet engine . So the two things we need, besides a regular web server, are
Saxon includes a basic servlet class called SaxonServlet in the examples/java subdirectory of the Saxon distribution. This class is fairly simple and is included more as a proof-of-concept demo than a production-ready servlet implementation. For one thing, the only way to pass the names of the source document and the stylesheet to this servlet is via a URL of the form
Can we simplify this? You may want to have the servlet fired for any .xml file requested from the server, as in
The stylesheet URI in this case might be taken from the <?xml-stylesheet?> processing instruction in page.xml . This is possible if you
configure your server to associate all .xml files with the Saxon servlet; and
modify the Saxon servlet so that it can take the URI it is called with as source and use the processing instruction in the source document to find the stylesheet.
Better yet, install Cocoon ( 7.2 ) over Tomcat and let the former solve this problem in an elegant and generic fashion.
18.104.22.168 Tomcat servlet engine
A good servlet engine is Tomcat,  developed by the Apache Software Foundation. Tomcat is the reference implementation of the Java Servlet and JSP (Java Server Pages) technologies.
Tomcat may work as a servlet engine with another web server, such as Apache or Microsoft IIS, but it also contains a web server of its own. So, you don't have to run a full-featured web server if you want to install Tomcat on your local system to experiment with it. Note that you'll also need to install Tomcat (with or without a separate web server) if you want to run the Cocoon framework discussed in the next section.
Refer to 7.2.6 , steps 1 to 4, for instructions on installing and testing Tomcat. See the Tomcat documentation on how to install web applications (such as the Saxon servlet) into Tomcat.