blob: a2130addbd75580cedbbe08a1e9473142ac2b019 [file] [log] [blame]
<?xml version="1.0" standalone="no"?>
<!DOCTYPE s1 SYSTEM "../../style/dtd/document.dtd">
<!--
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 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">
<ul>
<li><link idref="commandline_xsltc">Command line options for XSLTC</link></li>
</ul>
<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>). Also include xsltc.jar in the classpath if you want to use
the XSLTC related options.<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>
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)
Options for the Xalan interpreter
-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 the Xalan compiler (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)
</source>
<p>Use <code>-XSLTC</code> if you want to transform with XSLTC. Please refer to
<link idref="commandline_xsltc">this document</link> for a detailed description on
the 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 <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>