xalan-j/commandline.html (265 lines of code) (raw):

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>ASF: Command-Line Utility</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <link rel="stylesheet" type="text/css" href="resources/apache-xalan.css" /> </head> <!-- * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. --> <body> <div id="title"> <table class="HdrTitle"> <tbody> <tr> <th rowspan="2"> <a href="../index.html"> <img alt="Trademark Logo" src="resources/XalanJ-Logo-tm.png" width="190" height="90" /> </a> </th> <th text-align="center" width="75%"> <a href="index.html">Xalan XSL Transformer User's Guide</a> </th> </tr> <tr> <td valign="middle">Command-Line Utility</td> </tr> </tbody> </table> <table class="HdrButtons" align="center" border="1"> <tbody> <tr> <td> <a href="http://www.apache.org">Apache Foundation</a> </td> <td> <a href="http://xalan.apache.org">Xalan Project</a> </td> <td> <a href="http://xerces.apache.org">Xerces Project</a> </td> <td> <a href="http://www.w3.org/TR">Web Consortium</a> </td> <td> <a href="http://www.oasis-open.org/standards">Oasis Open</a> </td> </tr> </tbody> </table> </div> <div id="navLeft"> <ul> <li> <a href="resources.html">Resources</a> <br /> </li> <li> <a href="http://xalan.apache.org/index.html">Home</a> </li></ul><hr /><ul> <li> <a href="index.html">Xalan-J 2.7.3</a> </li> <li> <a href="charter.html">Charter</a> </li></ul><hr /><ul> <li> <a href="whatsnew.html">What's New</a> </li> <li> <a href="readme.html">Release Notes</a> </li></ul><hr /><ul> <li> <a href="overview.html">Overview</a> </li> <li> <a href="downloads.html">Download/Build</a> </li> <li> <a href="getstarted.html">Getting Started</a> </li> <li> <a href="xsltc_usage.html">Using XSLTC</a> </li></ul><hr /><ul> <li> <a href="faq.html">FAQs</a> </li></ul><hr /><ul> <li> <a href="samples.html">Sample Apps</a> </li> <li>Command Line<br /> </li></ul><hr /><ul> <li> <a href="features.html">Features</a> </li> <li> <a href="trax.html">Transform API</a> </li> <li> <a href="xpath_apis.html">XPath API</a> </li> <li> <a href="usagepatterns.html">Usage Patterns</a> </li></ul><hr /><ul> <li> <a href="apidocs/index.html">Xalan-J API</a> </li> <li> <a href="public_apis.html">Public APIs</a> </li> <li> <a href="dtm.html">DTM</a> </li></ul><hr /><ul> <li> <a href="extensions.html">Extensions</a> </li> <li> <a href="extensionslib.html">Extensions Library</a> </li> <li> <a href="extensions_xsltc.html">XSLTC Exts</a> </li></ul><hr /><ul> <li> <a href="design/design2_0_0.html">Xalan 2 Design</a> </li> <li> <a href="xsltc/index.html">XSLTC Design</a> </li></ul><hr /><ul> <li> <a href="builds.html">Building a release</a> </li> <li> <a href="http://xml.apache.org/xalan-j/test/overview.html">Testing</a> </li> <li> <a href="bugreporting.html">Bug Reporting</a> </li></ul><hr /><ul> <li> <a href="contact_us.html">Contact us</a> </li> </ul> </div> <div id="content"> <h2>Command-Line Utility</h2> <ul> <li> <a href="commandline_xsltc.html">Command line options for XSLTC</a> </li> </ul> <p align="right" size="2"> <a href="#content">(top)</a> </p> <h3>Using the Command-Line Utility</h3> <p>To perform a transformation, you can call Xalan-Java from the command line (or script), an applet, an application, or a servlet (see <a href="usagepatterns.html">Usage Patterns</a>).</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 Xalan-Java.<br /> <br /> </li> <li> <a href="getstarted.html#classpath">Set the Java classpath</a> to include <code>xalan.jar</code>, <code>serializer.jar</code>, <code>xml-apis.jar</code>, and <code>xercesImpl.jar</code> -- or another conformant XML Parser -- (see <a href="usagepatterns.html#plug">Plugging in the Transformer and XML parser</a>).<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> <blockquote class="source"> <pre> Common Options -XSLTC (use XSLTC for transformation) -IN inputXMLURL -XSL XSLTransformationURL -OUT outputFileName -V (Version info) -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 expression (Set a stylesheet parameter) -MEDIA mediaType (use media attribute to find stylesheet associated with a document) -FLAVOR flavorName (Explicitly use s2s=SAX or d2d=DOM to do transform) -DIAG (Print overall milliseconds transform took) -URIRESOLVER full class name (URIResolver to be used to resolve URIs) -ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities) -CONTENTHANDLER full class name (ContentHandler to be used to serialize output) -SECURE (set the secure processing feature to true) Options for Xalan-Java Interpretive -QC (Quiet Pattern Conflicts Warnings) -TT (Trace the templates as they are being called) -TG (Trace each generation event) -TS (Trace each selection event) -TTC (Trace the template children as they are being processed) -TCLASS (TraceListener class for trace extensions) -L (use line numbers for source document) -INCREMENTAL (request incremental DTM construction by setting http://xml.apache.org/xalan/features/incremental to true) -NOOPTIMIMIZE (request no stylesheet optimization proccessing by setting http://xml.apache.org/xalan/features/optimize to false) -RL recursionlimit (assert numeric limit on stylesheet recursion depth) Options for Xalan-Java Compiled (XSLTC) -XO [optional transletName] (assign the name to the generated translet) -XD destinationDirectory (specify a destination directory for translet) -XJ jarfile (package translet classes into a jar file of name &lt;jarfile&gt;) -XP package (specify a package name prefix for all generated translet classes) -XN (enable XSL template inlining into one big method) -XX (turn on additional debugging message output) -XT (use translet to transform if possible) </pre> </blockquote> <p>Use <code>-XSLTC</code> if you want to transform with XSLTC. Please refer to <a href="commandline_xsltc.html">this document</a> for a detailed description on XSLTC related options.</p> <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 &lt;br&gt;, 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 <b> <i>name value</i> </b> </code> </p> <p>The value is passed to the transformer as a String.</p> <p>For information about incremental and optimized stylesheet processing, see <a href="dtm.html#settings">DTM settings</a>.</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 <a href="extensionslib.html#nodeinfo">NodeInfo extension functions</a> and <a href="features.html#source_location">source_location</a>.</p> <p>Use <code>-URIRESOLVER</code> with a fully qualified class name to utilize a custom implementation of the <a href="apidocs/javax/xml/transform/URIResolver.html">URIResolver</a> JAXP 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 <a href="apidocs/org/xml/sax/EntityResolver.html">EntityResolver</a> 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 <a href="apidocs/org/xml/sax/ContentHandler.html">ContentHandler</a> SAX interface to serialize output. If this same class implements the <a href="apidocs/org/xml/sax/ext/LexicalHandler.html">org.xml.sax.ext.LexicalHandler</a> interface and the output method is "xml", it will also receive lexical information about the XML document during serialization.</p> <table class="note"> <tr> <td class="noteImg"> <img src="resources/note.gif" alt="note" /> </td> <td class="noteTxt">If you want to validate an XML document (verify that it adheres to its DOCTYPE declaration), you can use the <a href="samples.html#validateutility">Validate utility</a> shipped with Xalan-Java.</td> </tr> </table> <p align="right" size="2"> <a href="#content">(top)</a> </p> </div> <div id="footer">Copyright © 1999-2023 The Apache Software Foundation<br />Apache, Xalan, and the Feather logo are trademarks of The Apache Software Foundation<div class="small">Web Page created on - Thu 2023-04-14</div> </div> </body> </html>