You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dl...@locus.apache.org on 2000/02/12 00:19:03 UTC

cvs commit: xml-xalan/xdocs/sources/xalan samples.xml overview.xml getstarted.xml api.xml

dleslie     00/02/11 15:19:02

  Modified:    xdocs/sources/xalan samples.xml overview.xml getstarted.xml
                        api.xml
  Log:
  Updates around new "Getting Started"
  
  Revision  Changes    Path
  1.2       +69 -46    xml-xalan/xdocs/sources/xalan/samples.xml
  
  Index: samples.xml
  ===================================================================
  RCS file: /home/cvs/xml-xalan/xdocs/sources/xalan/samples.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- samples.xml	2000/02/04 14:39:50	1.1
  +++ samples.xml	2000/02/11 23:18:58	1.2
  @@ -7,69 +7,90 @@
   
   <!DOCTYPE s1 SYSTEM "sbk:/style/dtd/document.dtd">
   <s1 title="Samples">
  -       
  +<ul>
  +<li><link anchor="simpletransform">SimpleTransform</link></li>
  +<li><link anchor="transformtodom">TransformToDom</link></li>
  +<li><link anchor="usestylesheetparam">UseStylesheetParam</link></li>
  +<li><link anchor="validatexpath">ValidateXPath</link></li>
  +<li><link anchor="pipe">Pipe (SAX)</link></li>
  +<li><link anchor="extensions">Extensions</link></li>
  +<li><link anchor="applet">Applet</link></li>
  +<li><link anchor="servlet">Servlet</link></li>
  +</ul>       
   	  <s2 title="Samples to help you get started">
  -    <p>Each of the subdirectories in the &xslt4j; samples directory contains one or more sample applications that
  -     you can run, examine, modify, and rebuild.</p> 
  -    <p>You can use the make file to build the samples. To build all the samples at once, run the make file from the samples
  -    directory:</p> 
  -    <p><code>make -samples</code></p>
  -    <p>To build and/or run one of the samples, run the make file in the pertinent subdirectory:</p> 
  -    <p><code>make -test</code></p>
  -    <p>For more information about running the make files, see the instructions for <link idref="ltsinstall" 
  -    anchor="rebuilding&xslt4j;">rebuilding &xslt4j;</link>.</p>
  -    <p>The make file sets the classpath and uses javac to compile the java files. In place of the make files, you can
  -    set the classpath yourself and run javac: be sure to include &xslt4j;.jar (or xalan.jar), xerces.jar, and the samples
  -    subdirectory in the classpath. No build is required for the sample applet.</p>
  -    <p>The make file in each sample subdirectory (except applet and server, servlet) also runs the sample application. 
  -    You can run most of these samples with</p> 
  -    <p><code>java <ref>classname</ref></code></p>
  -    <p>where <ref>classname</ref> is the classname. The samples in params and ValidateXPath take an argument in addition to classname. The samples in extensions use the <link idref="commandline">command-line utility</link>, so they take arguments for the XML source file and the XSL stylesheet.</p>
  -  	</s2>
  -    <s2 title="simple">
  +    <p>Each of the subdirectories in the &xslt4j; samples directory contains the source files for one or more
  +     sample applications. The class files for all the samples are in xalansamples.jar, so to run the samples, 
  +     you should place xalansamples.jar on the system class path.</p>
  +     <p>With most of the samples, you can use the following procedure:</p>
  +     <ol>
  +     <li>Be sure xalan.jar, xalansamples.jar, and xerces.jar are on the system class path. For the extension
  +      examples, bsf.jar, bsfengines.jar, and (for the JavaScript extensions) js.jar must also be on the class
  +      path.</li>
  +     <li>Be sure java.exe is on your path.</li>
  +     <li>Go to the samples subdirectory containing the sample (use the DOS shell if you are running Windows).</li>
  +     <li>Run the sample from the command line (as indicated below)</li>
  +    <li>Examine the application source files. You may also want to modify the source files. Remember that if you
  +     modify a java file, you must recompile the class and place it on the class path before you can run the
  +     modified application.</li>
  +     </ol>      
  +    <p>The basic command line for running most of the samples is </p> 
  +    <p><code>java <ref>classname args</ref></code></p>
  +    <p>where <ref>classname</ref> is the classname and <ref>args</ref> are the arguments, if any. As described in
  +     the
  +     following sections, some samples take no arguments. The samples in params and ValidateXPath take an argument
  +     in addition to classname. The samples in extensions use the &xslt4j; <link idref="commandline">command-line
  +     utility</link>, so they take arguments for the XML source file and the XSL stylesheet.</p>
  +  	</s2><anchor name="simpletransform"/>
  +    <s2 title="SimpleTransform">
       <p>What it does: The SimpleTransform class uses the foo.xsl stylesheet to transform foo.xml, and prints the
        output to System.out.</p>
  -    <p>You can run it from the command line with</p>
  +    <p>You can run it from the SimpleTransform subdirectory with</p>
       <p><code>java SimpleTransform</code></p>
  -    </s2>
  -    <s2 title="dom1">
  +    </s2><anchor name="transformtodom"/>
  +    <s2 title="TransformToDom">
       <p>What it does: The TransformToDom class uses the foo.xsl stylesheet to transform foo.xml, produces an output
  -     DOM, and traverses the DOM, printing the traversal to System.out. In contrast to "simple," "dom1" illustrates
  -      the procedure gor creating an output DOM which is then available for further processing.</p>
  -   <p>You can run it from the command line with</p>
  -    <p><code>java SimpleTransform</code></p>
  -    </s2>
  -    <s2 title="params">
  +     DOM, and traverses the DOM, printing the traversal to System.out. In contrast to SimpleTransform,
  +      TransformToDom illustrates the procedure for creating an output DOM that is available for further
  +      processing.</p>
  +   <p>You can run it from the TransformToDom subdirectory with</p>
  +    <p><code>java TransformToDom</code></p>
  +    </s2><anchor name="usestylesheetparam"/>
  +    <s2 title="UseStylesheetParam">
         <p>What it does: The UseStyleSheetParam class uses foo.xsl and a stylesheet parameter to transform foo.xml,
          and prints the output to System.out. The stylesheet parameter appears as a text node in the output.</p>
  -    <p>Run this sample from the command line with</p> 
  +    <p>Run this sample from the UseStylesheetParam subdirectory with</p> 
       <p><code>java UseStylesheetParam <ref>param</ref></code></p>
       <p>where <ref>param</ref> is the stylesheet parameter.</p>  
  -    </s2>
  +    </s2><anchor name="validatexpath"/>
       <s2 title="ValidateXPath">
       <p>What it does: The ValidateXPath class validates and displays a textual diagram of an XPath expression.</p>
  -    <p>Run this sample from the command line with</p> 
  +    <p>Run this sample from the ValidateXPath subdirectory with</p> 
       <p><code>java ValidateXPath <ref>XPathExpression</ref></code></p>
       <p>where <ref>XPathExpression</ref> is an XPath expression, such as "aa/bb//xx".</p>  
  -    </s2>
  -    <s2 title="pipe">
  +    </s2><anchor name="pipe"/>
  +    <s2 title="Pipe">
       <p>What it does: The Pipe class uses the output of the first transformation as input to a second
        transformation.</p>
  -    <p>Run it from the command line with</p> 
  +     <p>The first transformation produces a sequence of SAX events which the second transformation processes with
  +      its own stylesheet. The consumer of SAX output can respond to these events as they occur, rather than waiting
  +       for the entire result tree to be constructed (as the DOM consumer must do).</p>
  +    <p>Run this sample from the Pipe subdirectory with</p> 
       <p><code>java Pipe</code></p>
  -    </s2>
  -    <s2 title="extensions".
  +    <p>For other examples using the SAX document handler, see <link idref="getstarted" anchor="sax">Generating and
  +     responding to SAX events</link>.</p>
  +    </s2><anchor name="extensions"/>
  +    <s2 title="Extensions">
       <p>The extensions subdirectory contains four samples with &xslt4j; extensions. Two of the samples use
        extensions implemented in JavaScript, and two of the samples use extensions implemented in Java. All of
  -     the samples are documented at length in <link idref="extensions">Extensions</link>.</p>
  -     <p>To run these examples, you must place bsf.jar, bsfengines.jar (distributed with &xslt4j;, and js.jar
  -     (availabe from http://www.mozilla.org/rhino) on the class path. You do not need js.jar
  +     the samples are documented in <link idref="extensions">Extensions</link>.</p>
  +     <p>To run these examples, you must place bsf.jar and bsfengines.jar (distributed with &xslt4j;), and js.jar
  +     (availablee from http://www.mozilla.org/rhino) on the class path. You do not need js.jar
        on the class path for the samples that use Java extensions. </p>
  -     <p>You can use java.org.apache.xalan.xslt.Process, the &xsl4j; command-line utility, to run these samples from
  +     <p>Use java.org.apache.xalan.xslt.Process, the &xslt4j; command-line utility, to run these samples from
         the command line. The command line must include an -in argument with the XML source and an -xsl argument with
         the XSL stylesheet. If you want the output to be printed to a file, rather than to the screen, add an -out
         argument for the output file.</p>
  -      <p>Run these samples from the command line with</p> 
  +      <p>Run these samples from the extensions directory as follows:</p> 
   
         <p><code>java org.apache.xslt.xalan.Process -in 1basicJscript</code> 
           <br/>&nbsp;&nbsp;<code>-xsl 1basicJscript</code></p>
  @@ -79,13 +100,15 @@
           <br/>&nbsp;&nbsp;<code>-xsl 3numlistJava.xsl</code></p>
         <p><code> java org.apache.xslt.xalan.Process -in 4numlistJcript.xml </code>
           <br/>&nbsp;&nbsp;<code>-xsl 4numlistJscript.xsl</code></p>
  -    </s2>
  -    <s2 title="applet">
  +    </s2><anchor name="applet"/>
  +    <s2 title="Applet">
       <p>The applet uses a stylesheet to transform an XML document into HTML. It displays the XML document, the
        stylesheet, and the HTML output.</p>
  -    <p>How to run it: See <jump href="samples/applet/readme.html">sample applet readme</jump>.</p>  
  -    </s2>
  -    <s2 title="server and servlet">
  +    <p>How to run it: See <jump href="samples/applet/readme.html">sample applet readme</jump>.</p>
  +    <p>For a brief introduction to using applets to perform transformations, see <link idref="getstarted"
  +    anchor="applet">Using the &xslt4j; applet wrapper</link></p>  
  +    </s2><anchor name="servlet"/>
  +    <s2 title="Servlet">
       <p>What it does: The client (which you must set up) specifies an XML document and a stylesheet. The servlet
        performs the transformation and returns the output to the client. You can use media.properties to specify 
       which stylesheet is to be used depending on the client browser/device.</p>
  
  
  
  1.2       +32 -1     xml-xalan/xdocs/sources/xalan/overview.xml
  
  Index: overview.xml
  ===================================================================
  RCS file: /home/cvs/xml-xalan/xdocs/sources/xalan/overview.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- overview.xml	2000/02/04 14:39:50	1.1
  +++ overview.xml	2000/02/11 23:18:58	1.2
  @@ -128,10 +128,41 @@
       and XPath</jump><br/><br/></li>
       <li>The Mulberry <jump href="http://www.mulberrytech.com/xsl/xsl-list/">XSL-List -- Open Forum on XSL</jump> 
       (of interest to XSL users at all levels)<br/><br/></li>
  -    <li>Dave Pawson's <jump href="http://www.dpawson.co.uk/">XSL Frequently Asked Questions</jump><br/><br/></li>
  +    <li>Dave Pawson's <jump href="http://freespace.virgin.net/b.pawson/xsl/index.html#top">XSL Frequently Asked Questions</jump><br/><br/></li>
   <li>Objects by Design's <jump href="http://www.objectsbydesign.com/projects/xmi_to_html.html">Transforming XMI to HTML</jump><br/><br/></li>
  +<li>Nic Miloslav's <jump href="http://zvon.vscht.cz/HTMLonly/XSLTutorial/Books/Book1/index.html">XSL Tutorial</jump> 
  +<br/><br/></li>
       </ul>
       <p>This is a very preliminary list. If you have come across other useful introductionary or background materials,
        please email <human-resource-ref idref="dleslie"/>, so he can add them to this list.</p>
       </s2>
  +       <s2 title="Glossary">
  +      <gloss>
  +        <label>XSL Instruction</label>
  +        <item>Any tag with an XSL namespace prefix.<br/><br/></item>
  +        
  +        <label>XSL Template Instruction</label>
  +        <item>Any tag with an XSL namespace prefix
  +            that occurs inside an xsl:template element.<br/><br/></item>
  +            
  +        <label>Template Child</label>
  +        <item>Any node that is a child of an xsl:template element.<br/><br/></item>
  +        
  +        <label>Source Tree</label>
  +        <item>The tree input to the XSL process.<br/><br/></item>
  +        
  +        <label>Result Tree</label>
  +        <item>The tree that is output by the XSL process.<br/><br/></item>
  +        
  +        <label>Stylesheet Tree</label>
  +        <item>The stylesheet tree produced from the XSL file.<br/><br/></item>
  +        
  +        <label>Pattern List</label>
  +        <item>A parsed query or match pattern.<br/><br/></item>
  +      </gloss>
  +      <p>For more definitions of XSLT terminology, see Dave Lawson's 
  +      <jump href="http://freespace.virgin.net/b.pawson/xsl/xslvocab.html#top">XSLT Terminology
  +      Clarification</jump>.</p>
  +    </s2>
  +
   </s1> 
  
  
  
  1.2       +227 -41   xml-xalan/xdocs/sources/xalan/getstarted.xml
  
  Index: getstarted.xml
  ===================================================================
  RCS file: /home/cvs/xml-xalan/xdocs/sources/xalan/getstarted.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- getstarted.xml	2000/02/04 14:39:50	1.1
  +++ getstarted.xml	2000/02/11 23:18:59	1.2
  @@ -19,78 +19,264 @@
   <li>xerces.jar</li>
   </ul>
   <p>You can get the Sun JDK or JRE from <jump href="http://www.java.sun.com">java.sun.com</jump>. Download the latest release of Xalan and Xerces-java from <jump href="http://xml.apache.org/dist/">xml.apache.org</jump>. Check the <link idref="readme" anchor="status">version release notes</link> to verify that you are using the correct version of Xerces. <em>Important</em> You may experience unpredicable difficulties and anomalies if your Xalan and Xerces builds are not in synch.</p>
  -<note>You may also download the latest releases of LotusXSL and the XML Parser for Java from <jump href="http://www.alphaworks.ibm.com/tech/LotusXSL">alphaWorks</jump>. LotusXSL and the XML Parser for Java are Xalan and Xerces-java respectively, along with additional features and continued support for the core API that was in place on alphaWorks before the first releases of Xalan and Xerces-java on xml.apache.org in November 1999.</note>
  +<note>You may also download the latest releases of LotusXSL and the XML Parser for Java from <jump href="http://www.alphaworks.ibm.com/tech/LotusXSL">alphaWorks</jump>. LotusXSL and the XML Parser for Java are Xalan and Xerces-java respectively, along with additional features and wrappers to support the core API that was in place on alphaWorks before the first releases of Xalan and Xerces-java on xml.apache.org in November 1999.</note>
   <p>If you plan to run <link idref="extensions">XSLT extensions</link>. you need bsf.jar and bsfengines.jar, both of which are included in the Xalan distribution. If you plan to run XSLT extensions implemented in JavaScript or another scripting language, you will need one or more additional files as indicated in <link idref="extensions" anchor="supported-lang">extensions language requirements</link>.</p>
   </s2><anchor name="classpath"/>
   <s2 title="Setting up the system class path">
  -<p>At the very minimum, you must include xalan.jar and xerces.jar on the system class path. To run the examples, include xalansamples.jar To run extensions, include bsf.jar and bsfengines.jar. For extensions implemented in JavaScript or another scripting language, see <link idref="extensions" anchor="supported-lang">extensions language requirements</link> about the additional JAR files you must place on the class path.</p>
  -<p>If you are using JDK or JRE 1.x (at least 1.7, please), also include classes.zip on the class path.</p>
  +<p>At the very minimum, you must include xalan.jar and xerces.jar on the system class path. To run the examples, include xalansamples.jar To run extensions, include bsf.jar and bsfengines.jar. All these JAR files are distributed with &xslt4j;. For extensions implemented in JavaScript or another scripting language, see <link idref="extensions" anchor="supported-lang">extensions language requirements</link> to identify any additional JAR files you must place on the class path and where you can get them.</p>
  +<p>If you are using JDK or JRE 1.1.x (at least 1.1.7, please), also include classes.zip on the class path.</p>
   </s2><anchor name="samples"/>
   <s2 title="Trying out the samples">
  -<p>The Xalan distribution includes a number of basic samples. These examples are easy to run, and you can review the brief source files to see just how they work.</p>
  -<p>To run most of the samples, do the following:</p>
  +<p>The Xalan distribution includes a number of basic samples. These examples are easy to run, and you can review the source files -- all of which are brief -- to see just how they work.</p>
  +<p>To run the samples, do the following:</p>
   <ol>
   <li>Set up your class path (see above), including xalansamples.jar.</li>
   <li>Be sure java.exe is on your path.</li>
  -<li>(Using the DOS shell in Windows) Go to the samples subdirectory containing the sample.</li>
  +<li>Go to the samples subdirectory containing the sample (use the DOS shell if you are running Windows).</li>
   <li>Run the sample from the command line.</li>
   <li>Examine the application source files.</li>
   </ol>
  -<p>For example, to run SimpleTransformation, go to the simple subdirectory and issue the following command:</p>
  +<p>For example, go to the SimpleTransformation subdirectory and issue the following command:</p>
   <p><code>java SimpleTransformation</code></p>
  -<p>The sample displays its output on the screen. Then examine the source files: foo.xml, foo.xsl, and SimpleTransformation.java.</p>
  -<p>The procedure for running two of the samples is a little different: You run the applet sample from an HTML browser, and the servlet example from a web server with servlet support (such as Apache with WebSphere or Jserv).</p> 
  -<p>For information about the samples, see <link idref="samples">&xslt4j; Samples</link>.</p>
  -
  +<p>The sample displays the transformation result on the screen. To see how the example works, examine the source files: foo.xml, foo.xsl, and SimpleTransformation.java.</p>
  +<p>The extensions examples require additional JAR files on the class path, and the procedure for running the sample applet and sample servlet is different. For information about the samples, see <link idref="samples">&xslt4j; Samples</link>.</p>
   </s2><anchor name="commandline"/>
   <s2 title="Performing your own transformations from the command line">
   <p>java.org.apache.xalan.xslt.Process provides a basic utility for performing transformations from the command line. You use this utility, for example, to run the extensions samples. The command-line for the most standard of
    transformations is as follows:</p>
   <p><code>java org.apache.xalan.xslt.Process -in <ref>xmlSource</ref></code><br/>
  -<code>-xsl <ref>stylesheet</ref> -out <ref>outputfile</ref></code></p>
  +<code>&nbsp;&nbsp;&nbsp;&nbsp;-xsl <ref>stylesheet</ref> -out <ref>outputfile</ref></code></p>
  +<p>where <ref>xmlSource</ref> is the XML source file name, <ref>stylesheet</ref> is the XSL stylesheet file name, and <ref>outputfile</ref> is the output file name.</p>
   <p>If you want the output to be displayed on the screen, simply omit the -out argument.</p>
  +<p>You can use this utility to try out XSL stylesheets you have written, to make sure they do what you expect with the XML source files they are designed to transform. The utility provides useful messages if the source file or stylesheet is not well-formed. If you include a DOCTYPE statement in your XML source files and the -validate flag on the command line, the utility will also let you know whether the XML document adheres to that DOCTYPE. For more information, see <link idref="commandline">Command-Line Utility</link>.</p>
   </s2><anchor name="java-apps"/>
   <s2 title="Setting up your own Java applications">
  -<p>Modify the samples. Set up an XSLTProcessor with the right liaison, XSLTInput objects for the XML source and the stylesheet, an XSLTResultTarget object for the output. Then call the XSLTProcessor process method.</p>
  +<p>You can start by using your own XML source files and XSL stylesheets with the sample applications, which illustrate a number of the <link anchor="usage-patterns">basic usage patterns</link>.</p>
  +<p>If you modify a java source file, be sure to compile the class and place it on the system class path. Here are some basic points to keep in mind as you are setting up transformations:</p>
  +<ul>
  +<li>Use one of the <resource-ref idref="XSLTProcessorFactoryDoc"/> static getProcessor methods to set up an <resource-ref idref="XSLTProcessorDoc"/>. <br/><br/>By default, the XSLTProcessor uses the <resource-ref idref="DTMLiaison"/> and the high-performance <link idref="dtm">Document Table Model (DTM)</link>"pseudo" DOM parser to process the input.  If your input is a DOM node (rather than a file, character stream, byte stream, or SAX input stream), you must use a "standard" DOM liaison and parser, such as the <resource-ref idref="XercesLiaisonDoc"/> and the Xerces DOM parser. For an example, see <link anchor="dom-in">Processing DOM input</link>.<br/><br/></li>
  +<li>Set up <resource-ref idref="XSLTInputSourceDoc"/> objects for the XML input and XSL stylesheet. You can use a file name or URL, character streams, byte streams, or SAX input stream to instantiate an XSLTInputSource object.<br/><br/>
  +If the XML document contains a stylesheet Processing Instruction (PI), you do not need to create a separate
  +XSLTInputSource object for an XSL stylesheet.<br/><br/></li>
  +<li>For improved performance with a series of transformations, use the XSLTProcessor processStylesheet method to compile the XSL stylesheet.<br/><br/>
  +This is also useful when you need to get information from the stylesheet before the tranformation occurs, for
  +instance, when you need to find out the output encoding in order to construct the right kind of Writer.
  +You must also compile the stylesheet if you are using the XSLTProcessor as a SAX document handler.<br/><br/></li>
  +<li>Set up an <resource-ref idref="XSLTResultTargetDoc"/> for the transformation output. You can use a file name or URL, character stream, byte stream, or SAX document handler to instantiate an XSLTOutputTarget object.<br/><br/></li>
  +<li>Use the XSLTProcessor (or, in some cases, the <link idref="StylesheetRootDoc"/>) process method to perform the transformation.<br/><br/>
  +&xslt4j; is thread-safe for one instance per thread. If you are using the same instance of XSLTProcessor to perform
  +more than one transformation, call the reset method between transformations.</li>
  +</ul>
  +<p>For more information on setting up transformations, see the following section:</p>
   </s2><anchor name="usage-patterns"/>
   <s2 title="Basic usage patterns">
   <ul>
  -<li><link anchor="files">Use a stylesheet file to transform an XML source file into an output file</link></li>
  -<li><link anchor="params">Send stylesheet parameters</link></li>
  -<li><link anchor="compiled">For performance, use compiled stylesheets</link></li>
  -<li><link anchor="pipe">Pipe the output from one transformation to another transformation</link></li>
  -<li><link anchor="dom-in">Accept DOM input</link></li>
  -<li><link anchor="dom-out">Produce DOM output</link></li>
  -<li><link anchor="sax">Generate and respond to SAX events</link></li>
  -<li><link anchor="xpath">Work with XPath expressions</link></li>
  -<li><link anchor="extensions">Create and use extensions</link></li>
  +<li><link anchor="files">Using a stylesheet file to transform an XML source file into an output file</link></li>
  +<li><link anchor="streams">Using data streams in place of files</link></li>
  +<li><link anchor="params">Setting stylesheet parameters</link></li>
  +<li><link anchor="compiled">Compiling stylesheets</link></li>
  +<li><link anchor="dom-in">Processing DOM input</link></li>
  +<li><link anchor="dom-out">Producing DOM output</link></li>
  +<li><link anchor="sax">Generating and responding to SAX events</link></li>
  +<li><link anchor="xpath">Working with XPath expressions</link></li>
  +<li><link anchor="applet">Using the &xslt4j; applet wrapper</link></li>
  +<li><link anchor="servlet">Using &xslt4j; in a servlet</link></li>
  +<li><link anchor="extensions">Creating and using extensions</link></li>
   
   </ul><anchor name="files"/>
  -<s3 title="Use XML source, XSL stylesheet, and output files">
  -<p>Use an XML file and an XSL file to instantiate XSLTInput objects, create a processor with the default DTM liaison, and send the transformation output to an output file. For an example, see "Simple."</p>
  +<s3 title="Using XML source, XSL stylesheet, and output files">
  +<p>Use an XML file and an XSL file to instantiate XSLTInput objects, create a processor with the default DTM liaison, and send the transformation output to an output file. For example:</p>
  +<source>public static void transform(String xmlSourceURL, String xslURL, String outputURL)
  +  throws java.io.IOException, 
  +         java.net.MalformedURLException, 
  +         org.xml.sax.SAXException
  +{
  +  // Instantiate an XSLTProcessor.
  +  org.apache.xalan.xslt.XSLTProcessor processor =
  +                 org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor();
  +                 
  +  // Create the 3 objects the XSLTProcessor needs to perform the transformation.
  +  org.apache.xalan.xslt.XSLTInputSource xmlSource = 
  +                        new org.apache.xalan.xslt.XSLTInputSource ("foo.xml");
  +  org.apache.xalan.xslt.XSLTInputSource xslSheet = 
  +                       new org.apache.xalan.xslt.XSLTInputSource ("foo.xsl");
  +  org.apache.xalan.xslt.XSLTResultTarget xmlResult = 
  +                       new org.apache.xalan.xslt.XSLTResultTarget ("foo.out");
  +
  +  // Perform the transformation.
  +  processor.process(xmlSource, xslSheet, xmlResult);
  + }</source>
  +<p>For an online example, see <link idref="samples" anchor="simpletransform">SimpleTransform</link>.</p>
  +<p>You can perform this same operation from the <link idref="commandline">command line</link>. For example:</p>
  +<p><code>java org.apache.xalan.xslt.Process -in foo.xml -xsl foo.xsl -out output.xml</code></p>
  +</s3><anchor name="streams"/>
  +<s3 title="Using data streams in place of files">
  +<p>The context in which you perform a transformation may call for input in the form of a character stream, byte stream, or SAX input stream, and output in the form of a character stream, byte stream, or SAX document handler. Suppose, for example, you want to output a stream of bytes for further processing:</p>
  +<source>import org.apache.xalan.xslt.*;
  +...
  +java.io.OutputStream byteStream = new java.io.OutputStream();
  +XSLTRegultTarget out = new XSLTResultTarget(byteStream)
  +// Do the transformation...
  +// Work with the OutputStream...</source>
  +
   </s3><anchor name="params"/>
  -<s3 title="Send stylesheet parameters">
  -<p>When we generate the HTML documents that make up the Xalan doc set, for example, we send the stylesheet an id parameter along with each XML source document. The id identifies that document and enables the stylesheet to integrate it into the overall doc set.</p>
  +<s3 title="Setting stylesheet parameters">
  +<p>An XSL stylesheet can include parameters that get set at run time when a transformation takes place. When we generate the HTML documents that make up the Xalan doc set, for example, we send the stylesheet an id parameter along with each XML source document. The id identifies that document and enables the stylesheet to integrate it into the overall doc set.</p>
  +<p>To set a stylesheet parameter, use the XSLTProcessor setStylesheetParam(String paramName, String paramExpr) method. paramExpr is an XPath expression, so if the parameter is a String, enclose it in single quotes to make it a String expression.</p>
  +<p>You can also use setStylesheetParam(String key, XObject value). This option is useful when you are working with the XPath API. For example, you could use the XObject returned by an Xpath function to set a parameter.</p>
  +<p>From the <link idref="commandline">command line</link>, include a -param argument. For example:</p>
  +<p><code>java org.apache.xalan.xsltProcess -in foo.xml -xsl foo.xsl -param 'boo'</code></p>
   </s3><anchor name="compiled"/>
  -<s3 title="Compile your stylesheets">
  -<p></p>
  -</s3><anchor name="pipe"/>
  -<s3 title="Perform multi-staged transformations">
  -<p></p>
  +<s3 title="Compiling stylesheets">
  +<p>A <resource-ref idref="StylesheetRootDoc"/> object is a binary representation of a stylesheet that adds efficiency to the performance of repeated transformations and supports threadsafe concurrent access by multiple clients. If, for example, you are setting up a servlet to perform transformations, you can improve performance by compiling any stylesheets the servlet repeatedly uses.</p>
  +<p>To compile a stylesheet, use one of the the <resource-ref idref="XSLTProcessorDoc"/> processStylesheet methods. This operation also sets the XSLTProcessor Stylesheet property. In the interest of clarity, you may want to explicitly set that property. When you call the process method, include a null for the "uncompiled" stylesheet parameter so XLTProcessor uses the compiled stylesheet. For example:</p>
  +<source>import org.apache.xalan.xslt.*;
  +...
  +XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
  +StylesheetRoot style = processor.processStylesheet(new XSLTInputSource("foo.xsl"));
  +processor.setStylesheet(style); // Good form!
  +...
  +processor.process(new XSLTInputSource("foo.xml"),
  +                  null, // Use the Stylesheet property setting.
  +                  new XSLTOutputTarget("foo.out"));</source>
  +<p>Alternative: For convenience, StylesheetRoot has its own process method, so another way to do the preceding is as follows:</p>
  +<source>import org.apache.xalan.xslt.*;
  +..
  +XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
  +StylesheetRoot style = processor.processStylesheet(new XSLTInputSource("foo.xsl"));
  +...
  +style.process(new XSLTInputSource("foo.xml"), new XSLTOutputTarget("foo.out"));</source>
  +<p>If you want to use the XSLTProcessor as a SAX document handler, you must provide the processor a compiled stylesheet. See <link anchor="sax">Generating and Responding to SAX events</link>.</p>
   </s3><anchor name="dom-in"/>
  -<s3 title="Accept DOM input">
  -<p></p>
  +<s3 title="Processing DOM input">
  +<p>The XML source and XSL stylesheet for a transformation may appear in the form of a DOM Node. To perform transformations with DOM input, you cannot use the default high-performance DTM liaison and parser. <link idref="dtm">DTM (Document Table model)</link> uses a table of integers to represent a DOM, thus avoiding much of the overhead of creating and manipulating actual DOM nodes, which often involve a large number of Java objects. If you are processing DOM input, you must use a DOM parser, such as the Xerces DOM parser. When you create the XSLTProcessor for the transformation, you must specify that it is to use the Liaison for such a DOM parser.</p>
  +<p>The following code fragments illustrate the procedure for working with DOM input:</p>
  +<source>import org.apache.xerces.parsers.DOMParser;
  +import org.w3c.dom.Document;
  +import org.apache.xalan.xpath.xdom.XercesLiaison;
  +import org.apache.xalan.xslt.*;
  +...
  +// Just in case you want to produce your own DOM input...
  +DOMParser parser = new DOMParser();
  +parser.parse("foo.xml");
  +Document in = parser.getDocument();
  +XSLTInputSource xmlID = new XSLTInputSource(in);
  +
  +// Set up the XSLTProcessor to use XercesLiaison.
  +XSLTProcessor xsltProc = XSLTProcessorFactory.getProcessor
  +                 (new org.apache.xalan.xpath.xdom.XercesLiaison())
  +// or you can use XSLTProcessorFactory.getProcessorUsingLiaisonName
  +//                ("org.apache.xalan.xpath.xdom.XercesLiaison")
  +...
  +// Perform the transformation.</source>
   </s3><anchor name="dom-out"/>
  -<s3 title="Produce DOM output">
  -<p></p>
  +<s3 title="Producing DOM output">
  +<p>To produce a DOM Node as your transformation output, use a new Node to create the XSLTResultTarget for the transformation. Then when you perform the transformation, the result is output as a DOM Node. For example:</p>
  +<source>import org.w3.dom.Document;
  +import org.apache.xalan.xslt.*;
  +...
  +XSLTProcessor xsltProc = XSLTProcessorFactory.getProcessor();
  +org.w3c.dom.Document out = new org.apache.xerces.dom.DocumentImpl();
  +XSLTResultTarget resultTarget = new XSLTResultTarget(out);
  +processor.process(new XSLTInputSource("foo.xml"),
  +                  new XSLTInputSource("foo.xsl"),
  +                  resultTarget);</source>
  +<p>The XSLTResultTarget object (resultTarget) now contains a Node. For a working example, see <link idref="samples" anchor="transformtodom">TransformToDom</link>.</p>
   </s3><anchor name="sax"/>
  -<s3 title="Generate and respond to SAX events">
  -<p></p>
  +<s3 title="Generating and responding to SAX events">
  +<p>To set up a transformation to generate SAX events, set the DocumentHandler property of the XSLTResultTarget object. The transformation consumer can then respond to these events as they occur, rather than waiting (as the consumer of a DOM must) for the complete result tree.</p>
  +<p>This example sends the output to System.out.</p>
  +<source>import org.apache.xalan.xslt.XSLTProcessor;
  +import org.apache.xalan.xslt.XSLTInputSource;
  +import org.apache.xalan.xslt.XSLTResultTarget;
  +import org.apache.xalan.xslt.XSLTProcessorFactory;
  +import org.apache.xalan.xslt.StylesheetRoot;
  +
  +public class TransformToSax
  +{
  +	public static void main(String[] args)
  +    throws java.io.IOException,
  +           java.net.MalformedURLException,
  +           org.xml.sax.SAXException
  +	{
  +    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
  +
  +    // Set the processor to use a compiled stylesheet.
  +    // The stylesheet provides access to a SAX DocumentHandler,
  +    // passing it the stylesheet xsl:output settings.
  +    StylesheetRoot stylesheet = processor.processStylesheet("foo.xsl");
  +    // This property was just set implicitly, but for good form...
  +    processor.setStylesheet(stylesheet);
  +    // In this case, send the output to System.out.
  +    org.xml.sax.DocumentHandler dh = stylesheet.getSAXSerializer(System.out);
  +
  +    // Use the DocumentHandler to construct an XSLTResultTarget object.
  +    XSLTResultTarget saxResult = new XSLTResultTarget(dh);
  +
  +    // Perform the transformation. The stylesheet parameter is null, so
  +    // the processor uses the compiled stylesheet identified by its 
  +    // Stylesheet property setting.
  +    processor.process(new XSLTInputSource("foo.xml"), null, saxResult);
  +	}
  +}</source>
  +<p>XSLTProcessor also has a DocumentHandler property (in fact, XSLTProcessor extends DocumentHandler). By setting this property, you instruct the processor to process a sequence of SAX events. The processor needs a compiled stylesheet to perform this transformation.</p>
  +<p>The following example uses the output of one transformation as the input for a second transformation. It does this by using two SAX DocumentHandlers to pipe SAX events from the first transformation to the second.</p>
  +<source>import org.apache.xalan.xslt.*;
  +
  +public class ChainTransforms
  +{
  +	public static void main(String[] args)
  +    throws java.io.IOException,
  +           java.net.MalformedURLException,
  +           org.xml.sax.SAXException
  +	{
  +    // Create processor for 1st transform.
  +    XSLTProcessor processor1 = XSLTProcessorFactory.getProcessor();
  +
  +    // Create processor for 2nd transform. Set Stylesheet and
  +    // DocumentHandler properties so this processor uses the
  +    // 2nd stylesheet and processes SAX events (output from the
  +    // 1st transform), sending the final result to System.out.
  +    XSLTProcessor processor2 = XSLTProcessorFactory.getProcessor();
  +    StylesheetRoot stylesheet2 = processor2.processStylesheet("foo2.xsl");
  +    processor2.setStylesheet(stylesheet2);
  +    org.xml.sax.DocumentHandler dh = stylesheet2.getSAXSerializer(System.out);
  +    processor2.setDocumentHandler(dh);
  +
  +    // Set up the 1st transform to produce a series of SAX events, and
  +    // to pass these events to the processor for the 2nd transform.
  +    // To accomplish this, create an XSLTResultTarget object for the
  +    // 1st transform, and use the processor for the 2nd transform to set
  +    // the XSLTResultTarget DocumentHandler property.
  +    XSLTResultTarget intermedResult = new XSLTResultTarget();
  +    intermedResult.setDocumentHandler(processor2);
  +
  +    // Perform the 1st transform, which produces a series of
  +    // SAX events that are in turn processed by the processor2 DocumentHandler
  +    // in conjunction with stylesheet2, sending the output to System.out.
  +    processor1.process(new XSLTInputSource("foo.xml"),
  +                       new XSLTInputSource("foo.xsl"),
  +                       intermedResult);
  +	}
  +}</source>
  +<p>For a more compact (and elegant) form of this example, see the <link idref="samples" anchor="pipe">Pipe</link>.</p>
   </s3><anchor name="xpath"/>
  -<s3 title="Work with XPath expressions">
  -<p></p>
  +<s3 title="Working with XPath expressions">
  +<p>XSL stylesheets use XPath expressions to select nodes, specify conditions, and generate text for the result tree. XPath provides an API that you can call directly. For example, you may want to select nodes programatically and do your own processing without a stylesheet. For a preliminary example that verifies the syntax of inidvidual XPath expressions, see <link idref="samples" anchor="validatexpath">ValidateXPath</link>.</p>
  +</s3><anchor name="applet"/>
  +<s3 title="Using the &xslt4j; applet wrapper">
  +<ol> 
  +<li>Include <resource-ref idref="XSLTProcessorAppletDoc"/> in an HTML client.<br/><br/></li>
  +<li>Specify the XML source document and XSL stylesheet.<br/><br/>
  +You can use the DocumentURL and StyleURL PARAM tags or the <resource-ref idref="XSLTProcessorAppletsetDocumentURLDoc"/> and <resource-ref idref="XSLTProcessorAppletsetStyleURLDoc"/>. If the XML document contains a stylesheet Processing Instruction (PI), you do not need to specify an XSL stylesheet.<br/><br/></li>
  +<li>Call the <resource-ref idref="XSLTProcessorApplettransformtoHTMLstringstringDoc"/> which performs the transformation and returns the new document as a String.</li></ol>
  +<p>For an example, see the <jump href="samples/applet/readme.html">sample applet readme</jump>.</p>
  +</s3><anchor name="servlet"/>
  +<s3 title="Using &xslt4j; in a servlet">
  +<p>You can set up a servlet to use &xslt4j; to respond to requests for XML documents by transforming those documents into HTML and serving them to clients. For a sample of how this might be done, see <link idref="samples" anchor="servlet">sample servlet</link>.</p>
   </s3><anchor name="extensions"/>
  -<s3 title="Create and use extensions">
  -<p></p></s3>
  +<s3 title="Creating and using extensions">
  +<p>For those cases where you want to be able to call procedural code from within a stylesheet, the &xslt4j; Extensions facility supports the creation of extension elements and extension functions. See <link idref="extensions">Extensions</link> and <link idref="samples" anchor="extensions">Extensions samples</link>.</p>
  +</s3>
   </s2>
   </s1>
  
  
  
  1.2       +60 -123   xml-xalan/xdocs/sources/xalan/api.xml
  
  Index: api.xml
  ===================================================================
  RCS file: /home/cvs/xml-xalan/xdocs/sources/xalan/api.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- api.xml	2000/02/04 14:39:50	1.1
  +++ api.xml	2000/02/11 23:18:59	1.2
  @@ -67,111 +67,39 @@
       concerning the current release, see <link idref="readme">Release Notes</link>.</p>
        
       <p>&xslt4j; takes as primary input an XML source document and an XSL stylesheet. The XML document and the XSL stylesheet
  -    may be a URL or file, a character stream, an input stream, or a DOM tree. The stylesheet may also take the form of a
  +    may be a URL or file, a character stream, an byte stream, a DOM tree, or a SAX input source. The stylesheet may also take the form of a
       compiled stylesheet. If the XML document contains a stylesheet Processing Instruction (PI), a separate stylesheet is not
       required.</p>
  -    <p>&xslt4j; uses an implementation of the <resource-ref idref="XMLParserLiaisonDoc"/> to interact with &xml4j; (or another
  -     XML parser) and sends output events to an extension of
  +    <p>&xslt4j; uses an implementation of the <resource-ref idref="XMLParserLiaisonDoc"/> to interact with an
  +     XML parser) and sends output events to <resource-ref idref="XSLTResultTargetDoc"/>, an extension of
        <resource-ref idref="SAX"/> <resource-ref idref="SAXDocumentHandler"/>.</p>
  -     <p>The XSLT and XPath engines are independent from any given DOM or XML implementation. All parser-dependent calls are
  -     funneled through the XMLParserLiaison.</p>
  +     <p>The XSLT and XPath engines are independent from any given DOM or XML implementation. All parser-dependent
  +     calls are funneled through the XMLParserLiaison.</p>
     </s2>
      <s2 title="Performing XSL Transformations">
  -     <p>This release of &xslt4j; supports three mechanisms for transforming an xml document.</p>
  +     <p>This release of &xslt4j; directly supports three mechanisms for transforming an XML document.</p>
        <ul>
  -     <li>Calling the &xslt4j; processor from the command-line</li>
  -     <li>Calling the &xslt4j; API from another java class</li>
  -     <li>Using the &xslt4j; applet wrapper</li>    
  +     <li>Calling the &xslt4j; processor from the <link idref="commandline">command line</link></li>
  +     <li><link idref="getstarted" anchor="java-apps">Calling the &xslt4j; API from another java class</link></li>
  +     <li><link idref="getstarted" anchor="applet">Using the &xslt4j; applet wrapper</link></li> 
        </ul>
  -    <p>For information about performing transformation from the command-line or a script, see <jump
  -    href="CommandLineUtility"/>.</p>
  -    <s3 title="Calling the &xslt4j; API from a java class">
  -    <p>In the java class where you want to perform an XSL transformation, do the following:</p>
  -    <ol> 
  -    <li>Call one of the <resource-ref idref="XSLTProcessorFactoryDoc"/> static getProcessor() methods to
  -     instantiate an implementation of the <resource-ref idref="XSLTProcessorDoc"/>.<br/><br/>
  -     XSLTProcessorFactory uses XSLTEngineImpl, an implementation of the XSLTProcessor interface that you never need 
  -     to call directly.<br/><br/></li>
  -     <li>Create <resource-ref idref="XSLTInputSourceDoc"/> objects for the XML source document and the XSL stylesheet,
  -     and an <resource-ref idref="XSLTResultTargetDoc"/> object for the output.<br/><br/>
  -     If the XML document contains a stylesheet Processing Instruction (PI), you do not need to create
  -      a separate XSLTInputSource object for an XSL stylesheet.<br/><br/></li> 
  -     <li>Call the  <resource-ref idref="XSLTProcessorProcessDoc"/>.<br/><br/></li></ol>
  -     <p>In your application, for example, you could include the following transform method(), then call this method with file
  -     names or URLs for the source XML document, the XSL stylesheet and the new document to be produced.</p><source>
  -public static void transform(String xmlSourceURL, String xslURL, String outputURL)
  -  throws java.io.IOException, 
  -         java.net.MalformedURLException, 
  -         org.xml.sax.SAXException
  -{
  -  // Instantiate an XSLTProcessor.
  -  org.apache.xalan.xslt.XSLTProcessor processor =
  -                 org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor();
  -                 
  -  // Create the 3 objects the XSLTProcessor needs to perform the transformation.
  -  org.apache.xalan.xslt.XSLTInputSource xmlSource = 
  -                        new org.apache.xalan.xslt.XSLTInputSource (xmlSourceURL);
  -  org.apache.xalan.xslt.XSLTInputSource xslSheet = 
  -                       new org.apache.xalan.xslt.XSLTInputSource (xslURL);
  -  org.apache.xalan.xslt.XSLTResultTarget xmlResult = 
  -                       new org.apache.xalan.xslt.XSLTResultTarget (outputURL);
  +    <p>You can also use &xslt4j; to perform transformations in a servlet. For an example, see <link
  +     idref="samples" anchor="servlet">sample servlet</link>.</p>
  +<anchor name="applet"/>
   
  -  // Perform the transformation.
  -  processor.process(xmlSource, xslSheet, xmlResult);
  - }</source>
  -     <p>The XSLTProcessor "compiles" the input XSL stylesheet into an internal representation,
  -     the <resource-ref idref="StylesheetDoc"/>.  You can compile the stylesheet separately,
  -     before the transformation is complete, via the <resource-ref idref="XSLTProcessorProcessStylesheetDoc"/>.  This is
  -     especially useful when you need to get information from the stylesheet before the tranformation occurs, 
  -     for instance, when you need to find out the output encoding in order to construct the right kind of Writer.</p>
  -     <p>Stylesheet parameters can be set via the <resource-ref idref="XSLTProcessorSetStylesheetParamDoc"/>.
  -     This method takes as input an <resource-ref idref="XObjectDoc"/> or derivative. The 
  -     XObject class itself can hold any kind of Java object, if you need to pass it 
  -     to an extension.  Each XObject type has a convenience function on the XSLTProcessor class to make it easy 
  -     to create:</p>
  -     <ul>
  -     <li><resource-ref idref="XObjectDoc"/>, <resource-ref idref="XSLTProcessorCreateXObject"/></li>
  -     <li><resource-ref idref="XNodeSetDoc"/>, <resource-ref idref="XSLTProcessorCreateXNodeSet"/> or 
  -     <resource-ref idref="XSLTProcessorCreateXNodeSet2"/></li>
  -     <li><resource-ref idref="XBooleanDoc"/>, <resource-ref idref="XSLTProcessorCreateXBoolean"/></li>
  -     <li><resource-ref idref="XNumberDoc"/>, <resource-ref idref="XSLTProcessorCreateXNumber"/></li>
  -     <li><resource-ref idref="XNullDoc"/>, <resource-ref idref="XSLTProcessorCreateXNull"/></li>
  -     <li><resource-ref idref="XStringDoc"/>, <resource-ref idref="XSLTProcessorCreateXString"/></li>
  -     </ul>
  -     <p>&xslt4j; is thread-safe for one instance per thread.  <em>However, 
  -     if you reuse the processor instance, you should call reset() between calls.</em></p>
  -     <p>The XPath engine has pluggable backend drivers called <resource-ref idref="XLocatorDoc"/>s.
  -     The default implementation of the XLocator is the <resource-ref idref="SimpleNodeLocatorDoc"/>.
  -     Though users of the API can implement their own XLocators for custom data access, 
  -     it is not for the faint of heart.</p>         
  -</s3>
  -
  -<s3 title="Using the &xslt4j; applet">
  -<ol> 
  -<li>Include <resource-ref idref="XSLTProcessorAppletDoc"/> in an HTML client.<br/><br/></li>
  -<li>Specify the XML source document and XSL stylesheet.<br/><br/>
  -You can use the DocumentURL and StyleURL PARAM tags or the <resource-ref idref="XSLTProcessorAppletsetDocumentURLDoc"/> and <resource-ref idref="XSLTProcessorAppletsetStyleURLDoc"/>. If the XML document contains a stylesheet Processing Instruction (PI), you do not need to specify an XSL stylesheet.<br/><br/></li>
  -<li>Call the <resource-ref idref="XSLTProcessorApplettransformtoHTMLstringstringDoc"/> which performs the transformation and returns the new document as a String.</li></ol>
  -</s3>
   <anchor name="debugger-interface"/> 
   </s2>
       
   <s2 title="Debugger Interface">
  -		<p>&xslt4j; contains a debugger interface in the org.apache.xalan.xslt.trace package. This
  -		   should be looked upon as a work in progress, possibly to be replaced by a more 
  -		   standard interface in the future. The source code information given is 
  -		   somewhat limited by what the SAX interface provides... the line and column numbers 
  -		   at the *end* of the event. I'll have to work on obtaining the character selection 
  -		   of the executing event. Also, at this time there is no source tree line information 
  -		   available.  Again, I'll be working on this. The interfaces are:</p> 
  +		<p>&xslt4j; contains a debugger interface in the org.apache.xalan.xslt.trace package:</p> 
   		<ul>
   		  <li>The <resource-ref idref="TraceListenerDoc"/> is an interface that debuggers 
   		  can implement. The interface can be set on the 
   		  <resource-ref idref="XSLTProcessorDoc"/> by calling the addTraceListener() function.<br/><br/></li>
   		  <li>The <resource-ref idref="PrintTraceListenerDoc"/> is an implementation of 
  -		  the TraceListener interface that is used by &xslt4j; for the -TT, TG, and -TTC 
  -		  switches.  It's code is a good example to look at when figuring out how to 
  -		  use the trace functionality.<br/><br/></li>
  +		  the TraceListener interface that is used by the <link idref="commandline">command-line utility</link>
  +      for the -TT, TG, and -TTC. You can examine the utility code (org.apache.xalan.xslt.Process.java)
  +      for examples of how you might use the trace functionality.<br/><br/></li>
   		  <li>The <resource-ref idref="TracerEventDoc"/> is an event that is 
   		  passed to the TraceListener.trace() function.  It is called before a node is 'executed' 
   		  in the stylesheet.<br/><br/></li>
  @@ -179,41 +107,50 @@
   		  passed to the TraceListener.generated() function. It is called after an event 
   		  occurs to create something in the result tree.<br/><br/></li>
   		</ul>
  -	 </s2> 
  +    <p>Example:</p>
  +    <source>
  +import org.apache.xalan.xslt.XSLTProcessor;
  +import org.apache.xalan.xslt.trace.PrintTraceListener;
  +...
  +// Set up a PrintTraceListener object to print to a file.
  +java.io.FileWriter fw = new java.io.FileWriter("events.log");
  +java.io.PrintWriter pw = new java.io.PrintWriter(fw);
  +PrintTraceListener ptl = new PrintTraceListener(pw);
  +
  +// Print information as each node is 'executed' in the stylesheet.
  +ptl.m_traceElements = true;
  +// Print information after each result-tree generation event.
  +ptl.m_traceGeneration = true;
  +// Print information after each selection event.
  +ptl.m_traceSelection = true;
  +// Print information whenever a template is invoked.
  +ptl.m_traceTemplates = true;
  +
  +// Register the PrintTraceListener with the XSLTProcessor.
  +XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
  +processor.addTraceListener(ptl);
  +
  +...
  +// Perform the transformation -- printing information to 
  +// events.log during the process.
  +processor.process(new XSLTInputSource("foo.xml"),
  +                  new XSLTInputSource("foo.xsl"),
  +                  new XSLTResultTarget("foo.out"));
  +...
  +// Close the PrintWriter and FileWriter.
  +pw.close();
  +fw.close();
  +</source>
  +</s2> 
   	 
  -	 <s2 title="Source Code"> 
  -		<p>The source code is in the <resource-ref idref="SourceCodeDir"/>.</p> 
  -		<p>The <resource-ref idref="XSLTEngineImplJava"/> class is where the main
  -		  stuff is going on. This is a big file, so I highly recommend using an IDE.</p> 
  -		<p> The XPaths are parsed in the
  -		  <resource-ref idref="XPathProcessorImplDoc"/>, the result XPath object is
  -		  performed in the <resource-ref idref="XPathDoc"/>, and the query and pattern
  -		  match is performed in the <resource-ref idref="SimpleNodeLocatorDoc"/>>.</p> 
  +	 <s2 title="Notes on the source code">
  +   <ul>
  +		<li>The &xslt4j; source code tree is in the src directory.<br/><br/></li>
  +		<li>Much of the work involved in a transformation is performed by <resource-ref
  +    idref="XSLTEngineImplDoc"/>.<br/><br/></li> 
  +		<li>XPath expressions are parsed in the <resource-ref idref="XPathProcessorImplDoc"/>. 
  +    The <resource-ref idref="XPathDoc"/> represents the resulting XPath object. The
  +    <resource-ref idref="SimpleNodeLocatorDoc"/> performs queries and pattern matching.<br/><br/></li>
  +</ul>    
   	 </s2> 
  -   <s2 title="Glossary">
  -      <gloss>
  -        <label>XSL Instruction</label>
  -        <item>Any tag with an XSL namespace prefix.<br/><br/></item>
  -        
  -        <label>XSL Template Instruction</label>
  -        <item>Any tag with an XSL namespace prefix
  -            that occurs inside an xsl:template element.<br/><br/></item>
  -            
  -        <label>Template Child</label>
  -        <item>Any node that is a child of an xsl:template element.<br/><br/></item>
  -        
  -        <label>Source Tree</label>
  -        <item>The tree input to the XSL process.<br/><br/></item>
  -        
  -        <label>Result Tree</label>
  -        <item>The tree that is output by the XSL process.<br/><br/></item>
  -        
  -        <label>Stylesheet Tree</label>
  -        <item>The stylesheet tree produced from the XSL file.<br/><br/></item>
  -        
  -        <label>Pattern List</label>
  -        <item>A parsed query or match pattern.<br/><br/></item>
  -      </gloss>
  -    </s2>
  -
    </s1>