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

Overview

Downloads
Getting Started

FAQs

Sample Apps
Command Line
Usage Patterns

C++ API

Extensions

Release Notes

Bug reporting

Using the Command-Line Utility
 

To perform a transformation, you can call Xalan-C++ from the command line (or script), or from within an application (see Usage Patterns).

TestXSLT 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-C++.

  2. Set the path to include the build directory.

  3. Call the TestXSLT executable 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:

    TestXSLT -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
-ESCAPE chars(Which characters to escape -- default is <>&"'\r\n)
-EER (Expand entity references --default is not to expand)
-V (Version info)
-QC (Quiet Pattern Conflicts Warnings)
-Q  (Quiet Mode)
-INDENT (Number of spaces to indent each level in output tree --default is 0)
-VALIDATE (Validate the XSL and XML input -- default is not to validate)
-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)
-XML (Use XML formatter and add XML header)
-TEXT (Use simple Text formatter)
-HTML (Use HTML formatter)
The -XML flag must be set:
  -NH (Don't write XML header)
The -XML or -HTML flag must be set:
  -STRIPCDATA (Strip CDATA sections of their brackets, but do not escape)
  -ESCAPECDATA (Strip CDATA sections of their brackets, and escape)
-DOM (Test for well-formed output --format to DOM then to XML for output)
-PARAM name expression (Set a stylesheet parameter)

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 text nodes without any escaping.

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.


Enabling ICU support for TestXSLT
 

You can set up the International Components for Unicode (ICU) to enhance the support that Xalan-C++ provides for encoding, number formatting, and sorting. For more information, see Using the ICU.

If you have built and integrated the ICU with Xerces-C++, TestXSLT (like any Xalan-C++ application) automatically uses ICU support for output encoding. See Building ICU for Xerces-C++.

TestXSLT also conditionally includes ICU support for number formatting and sorting. Look in process.cpp for the #if defined(XALAN_USE_ICU) blocks. In these blocks, process.cpp #includes the ICUBridge headers, and substitutes ICU support for xsl:number, format-number(), and xsl:sort. To activate this support:

  1. Download and build the ICU (see Using the ICU).

  2. Rebuild TestXSLT with the ICU enabled (see below).
Rebuilding TestXSLT in Windows
 
  1. Uncomment the #define XALAN_USE_ICU in process.cpp.

  2. Add ICUBridge to the Visual C++ list of dependencies for the TestXSLT project.

  3. Build TestXSLT.exe.

Rebuilding TestXSLT in Linux or AIX
 

In Linux and AIX, the ICUBridge is in the core Xalan library (libxerces-c1_3.so in Linux; libxerces-c1_3.a in AIX), so you must rebuild this library along with TestXSLT.

Before you do the build, define the XALAN_USE_ICU environment variable. For information about defining this environment variable and doing a Linux or AIX build, see Steps for doing a Linux or AIX build.

NoteThe make file uses the XALAN_USE_ICU environment variable to do the equivalent of a #define and to add ICUBridge to the list of dependencies for TestXSLT. If you uncomment the #define XALAN_USE_ICU statement in process.cpp (which is the right thing to do in Windows), you will get an error in AIX ("The macro 'XALAN_USER{ICU' has already been defined") and a warning in Linux about duplicate settings when you run the make, and TextXSLT will not link with ICUBridge.



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