Command line options for XSLTC
| Using the Command-Line Utility |
| To perform a transformation, you can call Xalan-Java from the command line (or script), an applet, an application, or a servlet (see Usage Patterns). 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: Download Xalan-Java. Set the Java classpath to include `xalan.jar`, `serializer.jar`, `xml-apis.jar`, and `xercesImpl.jar` -- or another conformant XML Parser -- (see Plugging in the Transformer and XML parser). 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: `java org.apache.xalan.xslt.Process -IN foo.xml -XSL foo.xsl -OUT foo.out` The command line utility can take the following flags and arguments (the flags are case insensitive):
                          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 <jarfile>)
    -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)
Use `-XSLTC` if you want to transform with XSLTC. Please refer to this document for a detailed description on XSLTC related options. Use `-IN` to specify the XML source document. Use `-XSL` to specify the XSL stylesheet file. Use `-TEXT` if you want the output to include only element values (not element tags with element names and attributes). Use `-HTML` to write 4.0 transitional HTML (some elements, such as <br>, are not well formed XML). To set stylesheet parameters from the command line, use `java org.apache.xalan.xslt.Process -PARAM name value` The value is passed to the transformer as a String. For information about incremental and optimized stylesheet processing, see DTM settings. Use `-L` 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 NodeInfo extension functions and source_location. Use `-URIRESOLVER` with a fully qualified class name to utilize a custom implementation of the URIResolver JAXP interface to resolve URIs for xsl:include, xsl:import, and the document() function. Use `-ENTITYRESOLVER` with a fully qualified class name to utilize a custom implementation of the EntityResolver SAX interface to handle external entity references. Use `-CONTENTHANDLER` with a fully qualified class name to utilize a custom implementation of the ContentHandler SAX interface to serialize output. If this same class implements the org.xml.sax.ext.LexicalHandler interface and the output method is "xml", it will also receive lexical information about the XML document during serialization.
| If you want to validate an XML document (verify that it adheres to its DOCTYPE declaration), you can use the Validate utility shipped with Xalan-Java Version 2.7.3.

Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.