blob: 3b4ba34ab4e72cdda800ce40b3f81f50dbcb51f5 [file] [log] [blame]
<?xml version="1.0" standalone="no"?>
<!DOCTYPE s1 SYSTEM "../../style/dtd/document.dtd">
* Copyright 1999-2004 The Apache Software Foundation.
* Licensed 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
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and
* limitations under the License.
<!-- $Id$ -->
<s1 title="Command-Line Utility">
<li><link idref="commandline_xsltc">Command line options for &xslt4jc-short;</link></li>
<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>
<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>
<p>The command line utility can take the following flags and arguments (the flags are case insensitive):</p>
Common Options
-XSLTC (use &xslt4jc-short; for transformation)
-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)
Options for &xslt4ji;
-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 to true)
-NOOPTIMIMIZE (request no stylesheet optimization proccessing by setting to false)
-RL recursionlimit (assert numeric limit on stylesheet recursion depth)
Options for &xslt4jc-long; (&xslt4jc-short;)
-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)
<p>Use <code>-XSLTC</code> if you want to transform with &xslt4jc-short;. Please refer to
<link idref="commandline_xsltc">this document</link> for a detailed description on
&xslt4jc-short; 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
<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 <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 declaration), you can use the <link idref="samples" anchor="validateutility">Validate utility</link> shipped with &xslt4j-current;.</note>