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

Overview

Downloads
Getting Started

FAQs

Sample Apps
Command Line
Usage Patterns

API (Javadoc)

Xalan DTM
Extensions

Release Notes

Bug reporting

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 class path to include xalan.jar and xerces.jar

  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
-LXCIN compiledStylesheetFileNameIn
-LXCOUT compiledStylesheetFileNameOut
-PARSER fully qualified class name of parser liaison
-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)
-VALIDATE (Validate the XML and XSL input -- validation is off by default)
-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)

Use -IN to specify the XML source document.

Use -XSL to specify the XSL stylesheet file.

Use -LXCIN to specify a compiled XSL stylesheet file.

Use -LXCOUT to compile an XSL stylesheet for future use as -LXCIN input.

NoteYou can only use -LXCIN with a compiled stylesheet that you have already created with the -LXOUT switch. For an example, see Using a compiled stylesheet

Include -PARSER if you supply your own parser liaison class, which is required if you do not use DTM or the Xerces parser.

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
TestXSLT -PARAM name expression
To set the parameter to a string value, enclose the string in single quotes (') to make it an expression.

Using a compiled stylesheet

If you are using a stylesheet repeatedly, you can improve performance by compiling the stylesheet the first time you use it and using the compiled stylesheet for subsequent transformations.

For example, the following command line performs a transformation and compiles the stylesheet:"

java org.apache.xalan.xslt.Process -in foo.xml -xsl foo.xsl -lxcout foo.style

The following command line uses the compiled stylesheet for the next transformation:

java org.apache.xalan.xslt.Process -in foo2.xml -lxcin foo.style



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