| <?xml version="1.0" standalone="no"?> |
| <!DOCTYPE s1 SYSTEM "../../style/dtd/document.dtd"> |
| |
| <!-- |
| * The Apache Software License, Version 1.1 |
| * |
| * |
| * Copyright (c) 1999 The Apache Software Foundation. All rights |
| * reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| * are met: |
| * |
| * 1. Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * |
| * 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in |
| * the documentation and/or other materials provided with the |
| * distribution. |
| * |
| * 3. The end-user documentation included with the redistribution, |
| * if any, must include the following acknowledgment: |
| * "This product includes software developed by the |
| * Apache Software Foundation (http://www.apache.org/)." |
| * Alternately, this acknowledgment may appear in the software itself, |
| * if and wherever such third-party acknowledgments normally appear. |
| * |
| * 4. The names "Xalan" and "Apache Software Foundation" must |
| * not be used to endorse or promote products derived from this |
| * software without prior written permission. For written |
| * permission, please contact apache@apache.org. |
| * |
| * 5. Products derived from this software may not be called "Apache", |
| * nor may "Apache" appear in their name, without prior written |
| * permission of the Apache Software Foundation. |
| * |
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR |
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| * SUCH DAMAGE. |
| * ==================================================================== |
| * |
| * This software consists of voluntary contributions made by many |
| * individuals on behalf of the Apache Software Foundation and was |
| * originally based on software copyright (c) 1999, Lotus |
| * Development Corporation., http://www.lotus.com. For more |
| * information on the Apache Software Foundation, please see |
| * <http://www.apache.org/>. |
| --> |
| |
| |
| <s1 title="Command-Line Utility"> |
| |
| <s2 title="Using the Command-Line Utility"> |
| <p>To perform a transformation, you can call &xslt4j; from the command line (or script), |
| an applet, an application, or a servlet (see <link idref="usagepatterns">Usage Patterns</link>).</p> |
| <p>The org.apache.xalan.xslt.Process main() method provides a command-line interface |
| for performing XSL transformation. To perform a transformation from the command line or a script, |
| do the following:</p> |
| <ol> |
| <li>Download &xslt4j;.<br/><br/></li> |
| <li><link idref="getstarted" anchor="classpath">Set the Java classpath</link> to include xalan.jar, xml-apis.jar, and |
| &xml4j-jar; -- or another conformant XML Parser -- see <link idref="usagepatterns" anchor="plug">Plugging in |
| the Transformer and XML parser</link>).<br/><br/></li> |
| <li>Call java and the Process class with the appropriate flags and |
| arguments (described below). The following command line, for example, includes the -IN, -XSL, |
| and -OUT flags with their accompanying arguments -- the XML source document, the XSL |
| stylesheet, and the output file:<br/><br/> |
| <code>java org.apache.xalan.xslt.Process -IN foo.xml -XSL foo.xsl -OUT foo.out</code> |
| </li></ol> |
| <p>The command line utility can take the following flags and arguments (the flags are case insensitive):</p> |
| <source>-IN inputXMLURL |
| -XSL XSLTransformationURL |
| -OUT outputFileName |
| -V (Version info) |
| -QC (Quiet Pattern Conflicts Warnings) |
| |
| -TT (Trace the templates as they are being called) |
| -TG (Trace each result tree generation event) |
| -TS (Trace each selection event) |
| -TTC (Trace the template children as they are being processed) |
| -EDUMP [optional]FileName (Do stackdump on error) |
| -XML (Use XML formatter and add XML header) |
| -TEXT (Use simple Text formatter) |
| -HTML (Use HTML formatter) |
| -PARAM name value (Set a stylesheet parameter) |
| -DIAG (Print number of milliseconds transform operation took) |
| -FLAVOR flavorName (Transform with SAX for s2s or DOM for d2d) |
| -URIRESOLVER fullClassName (Use a custom URIResolver) |
| -ENTITYRESOLVER fullClassName (Use a custom EntityResolver) |
| -CONTENTHANDLER fullClassName (Use a custom ContentHandler) |
| -INCREMENTAL (Request incremental transform by setting |
| http://xml.apache.org/xalan/features/incremental to true) |
| -NOOPTIMIZE (Request no optizimation of stylesheet processing |
| by setting http://xml.apache.org/xalan/features/optimize to |
| false) |
| -RL recursionLimit (Set numeric limit on depht of stylesheet |
| recursion) |
| -L (Turn on source_location attribute) |
| </source> |
| <p>Use <code>-IN</code> to specify the XML source document.</p> |
| <p>Use <code>-XSL</code> to specify the XSL stylesheet file.</p> |
| <p>Use <code>-TEXT</code> if you want the output to include only element values (not element tags with element names and |
| attributes).</p> |
| <p>Use <code>-HTML</code> to write 4.0 transitional HTML (some elements, such as <br>, are |
| not well formed XML).</p> |
| <p>To set stylesheet parameters from the command line, use <br/> |
| <code>java org.apache.xalan.xslt.Process -PARAM <ref>name value</ref></code></p> |
| <p>The value is passed to the transformer as a String.</p> |
| <p>For information about incremental and optimized stylesheet processing, see <link idref="dtm" anchor="settings">DTM settings</link>.</p> |
| <p>Use <code>-L</code> to obtain access to a SourceLocator that a stylesheet extension can use to get information about the location |
| of nodes in the source document. For more information, see <link idref="extensionslib" anchor="nodeinfo">NodeInfo extension functions</link> |
| and <link idref="features" anchor="source_location">source_location</link>.</p> |
| <p>Use <code>-URIRESOLVER</code> with a fully qualified class name to utilize a custom implementation of the |
| <jump href="apidocs/javax/xml/transform/URIResolver.html">URIResolver</jump> TrAX interface to resolve URIs for |
| xsl:include, xsl:import, and the document() function.</p> |
| <p>Use <code>-ENTITYRESOLVER</code> with a fully qualified class name to utilize a custom implementation of the |
| <jump href="apidocs/org/xml/sax/EntityResolver.html">EntityResolver</jump> SAX interface to handle external entity references.</p> |
| <p>Use <code>-CONTENTHANDLER</code> with a fully qualified class name to utilize a custom implementation of the |
| <jump href="apidocs/org/xml/sax/ContentHandler.html">ContentHandler</jump> SAX interface to serialize output.</p> |
| <note>If you want to validate an XML document (verify that it adheres to its DOCTYPE declatation), you can use the <link idref="samples" anchor="validateutility">Validate utility</link> shipped with &xslt4j-current;.</note> |
| </s2> |
| </s1> |