




















|
 |  |  |  | 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:
- Download Xalan-C++.
- Set the path to include the build directory.
- 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)
The -XML flag must be set:
-NH (Don't write XML header)
-HTML (Use HTML formatter)
The -HTML flag must be set:
-NOINDENT (turns off HTML indenting)
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)
-TEXT (Use simple Text formatter)
-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:
- Download and build the ICU (see Using the ICU).
- Rebuild TestXSLT with the ICU enabled (see below).
 |  |  |  | Rebuilding TestXSLT in Windows |  |  |  |  |
| |
- Uncomment the
#define XALAN_USE_ICU in process.cpp.
- Add ICUBridge to the Visual C++ list of dependencies for the TestXSLT project.
- Build TestXSLT.exe.
|
 |  |  |  | Rebuilding TestXSLT in UNIX |  |  |  |  |
| |
In the Linux, AIX, HP-UX 11, and Solaris builds, the ICUBridge is in the core Xalan library (libxalan-c1_1.so in Linux; libxalan-c1_1.a in
AIX; libxalan-c1_1.sl in HP-UX 11; libxalan-c1_1.so in Solaris), 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 build, see Steps for doing a
UNIX build.
 | The 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_USE_ICU' has already been defined"), an error in HP-UX 11 ("Redefinition of macro 'XALAN-USE_ICU'
differs from previous definition"), or a warning in Linux or Solaris about duplicate settings when you
run the make, and TestXSLT does not link with ICUBridge. |
|
|
|
|