<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="samples" page="servlet" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: SaxonServlet</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: SaxonServlet"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>SaxonServlet</h1>
      <p><i>This section applies to the Java platform only.</i></p>
      <p>This is a general-purpose servlet that takes the name of a source document and XSLT stylesheet
as URL parameters, and uses the stylesheet to process the source document, creating a result
 document which is sent back to the browser for display. 
 The result document may have any media type, though HTML and XML are the most likely.</p>
      <p>The servlet maintains a cache of prepared stylesheets; if the same stylesheet is used repeatedly,
it is only parsed and validated once, which will often greatly improve performance. Prepared style
sheets are thread-safe so they can be used to serve documents to several users concurrently.</p>
      <p>The URLs for the source document and the stylesheet document are supplied in the URL,
which will typically take the form:</p>
      <p class="command">
http://server.com/servlets/SaxonServlet?source=doc.xml&amp;style=sheet.xsl
</p>
      <p><i>Note: Internet Explorer assumes that if the URL ends with ".xml" or ".xsl", as in
the above example, then the returned file will be XML - even if the media type in the HTTP header
is set to "text/html". You can prevent this behaviour by adding an extra dummy parameter, for example
"&amp;x=y".</i></p>
      <p>The source and style parameters identify the source document and stylesheet by URL.
These are interpreted relative to the servlet context. This means that specifying
say "style=/styles/styleone.xsl" in the URL will locate the stylesheet in this file relative to the
root directory for the web server.</p>
      <p>The stylesheet is prepared the first time it is used, and held in memory in a cache. The cache may
be cleared (for example, if a stylesheet has been changed) using a URL such as:</p>
      <p class="command">
http://server.com/servlets/SaxonServlet?clear-stylesheet-cache=yes
</p>
      <p>This code is provided purely as a sample, in the expectation that you will customise it to your
particular site requirements.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="books.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>