http://xml.apache.org/http://www.apache.org/http://www.w3.org/

What's New
DTM
XSLTC Translets

Overview
Getting Started

FAQs

Sample Apps
Command Line

Usage Patterns

TrAX
API (Javadoc)

Extensions
Extensions Library

Release Notes

Xalan 2 Design
XSLTC Design

Bugs
Testing

Credits
XSLTC Credits

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:

  1. Download Xalan-Java.

  2. Set the Java classpath to include xalan.jar and xerces.jar (or another conformant XML Parser -- see Plugging in the Transformer and XML parser).

  3. 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):

-IN inputXMLURL
-XSL XSLTransformationURL
-OUT outputFileName
-V (Version info)
-QC (Quiet Pattern Conflicts Warnings)
-Q  (Quiet Mode)
-LF (Use linefeeds only on output -- default is CR/LF)
-CR (Use carriage returns only on output -- default is CR/LF)
-INDENT (Number of spaces to indent each level in output tree --default is 0)
-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 put out timing diagnostics
-URIRESOLVER fullClassName (Use a custom URIResolver)
-ENTITYRESOLVER fullClassName (Use a custom EntityResolver)
-CONTENTHANDLER fullClassName (Use a custom ContentHandler)

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.

Use -URIRESOLVER with a fully qualified class name to utilize a custom implementation of the URIResolver TrAX 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.



Copyright © 2001 The Apache Software Foundation. All Rights Reserved.