Xslt Command Line Reference

Xslt.exe is the XmlPrime command line XSLT processor. It executes a specified transformation, with the specified options.

The command-line options are case sensitive.

 
Xslt.exe [Options] [XsltFile] [Parameters]
 

Arguments

ArgumentDescription

XsltFile

The path to the transformation.

Options

OptionAliasDescription

--compile

--c

Compiles and optimizes the transformation without running it. This can be useful to ensure a transformation is valid, without having a suitable input document at hand, and also for benchmarking purposes.

--dtd

--d

Enables the use of DTDs to validate input documents. By default, documents are not validated against their DTDs. Note that the DTDs are retrieved even when this option is disabled, as they are used to resolve entity references.

--emacs

Output errors and warnings in an single line format.

--explain

--e

Displays the transformation execution plan. This is a representation of the transformation after it has been compiled and fully optimized. This explains how XmlPrime intends to perform the transformation, and can be useful in highlighting errors in transforms if they are producing unexpected results. The execution plan is output to the standard error stream.

--help

-?

Displays usage instructions for the command line tool.

--multiple

-m

Allows multiple compilation errors to be reported. By default, compilation is aborted after the first error is discovered.

-im

Initiate execution of the transformation with the specified template mode. A namespace can be referred to with the syntax {namespace}localname.

-it

Initiate execution of the transform with the specified named template. A namespace can be referred to with the syntax {namespace}localname.

-o filename

Specifies a file to which the primary output of the transformation should be written. If the file already exists it is overwritten, otherwise a new file is created. If this option is omitted then the primary output of the transformation is sent to the standard output.

-O0

Disables compiler optimizations. This cannot be used in conjunction with any other -O option.

-O1

Disables any compiler optimizations that significantly change the structure of the transformation. This is useful for producing an execution plan if the result of a transformation is not what you expect. This cannot be used in conjunction with any other -O option.

-O2

Disables join optimizations. This feature is mainly for testing purposes. This cannot be used in conjunction with any other -O option.

-O3

Enabled join optimizations. This is the default optimization level. This cannot be used in conjunction with any other -O option.

-O4

Enables function specialization. This may significantly increase the compilation time. This cannot be used in conjunction with any other -O option.

--plan filename

-p filename

Write the execution plan as XML to the named file

--preserve

Preserves all white space text nodes in all input documents. This cannot be used in conjunction with the

--strip
option.

--repeat n

Repeats compilation and evaluation of the transformation n times. This can be used in order to get more accurate timing measurements, since initialization can take a long time and dominate the first few runs. Note that this will also cause the result of the transformation to be serialized and output n times.

-s document

Sets the context document for the transformation. document can either be a path to, or the URI of, an XML document to use as the context item.

--schema

-v

Validates input documents with XML Schema against the available schemas. All documents passed in on the command line or read by the query are validated against the available schemas. The available schemas used for validation contain:

  • Schemas imported using the --xsd option.
  • Schemas imported in the query.
  • Unless the --noxsiloc option is set, any schemas referenced in xs:schemaLocation or xs:noNamespaceSchemaLocation attributes are used to validate the document.

Note that this does not affect validate expressions, which will only validate against schemas imported in the query.

--strip

Strips insignificant whitespace text nodes from all input documents. This cannot be used in conjunction with the --preserve option.

--time

-t

Displays the time taken to analyse and evaluate the transformation. Timing information is sent to the standard error stream. To get more accurate timings, this can be used in combination with the --repeats and --noserialize flags.

--trace

This option causes a message to be output to the console every time a document is accessed by the transformation, and enables output from the trace function in the transformation to be displayed. Trace information is sent to the standard error stream.

--version

This option causes version information to be output to the console.

--xml10

Use XML 1.0 (5th edition) and Namespaces in XML 1.0. Note that in the current version, only XML 1.0 4th edition documents can be used as inputs.

--xml11

Use XML 1.1 (2nd edition) and Namespaces in XML 1.1. Note that in the current version, only XML 1.0 4th editino documents can be used as inputs.

---xsd schema

-x schema

Specifies the filename of an XML Schema to be added to the set of schemas available for validation. This mechanism also specifies the location of schemas imported in the transformation with no location hints. If the transformation imports a schema with the same namespace, then the schema supplied on the command line is used, regardless of which location hints are used.

--noxsiloc

Prevents schemas referenced by xsi:schemaLocation or xsi:noNamespaceSchemaLocation in imported documents from being loaded and added to the set of schemas used for validation.

Parameters

ParameterDescription

parametername=expression

Sets a stylesheet parameter to the specified value.

A stylesheet parameter is the definition of a global variable declared using xsl:param as a child of the xsl:stylesheet or xsl:transform element in the transformation.

The parametername is the local name of the parameter to be set. The parameter is assumed to have no namespace. An external variable declared with a namespace can be referred to with the syntax {namespace}localname. If no external variable is found with the specified name, then this parameter is ignored.

expression is an XPath expression which is evaluated to give the value of the parameter.

+parametername=document

Sets a stylesheet parameter to the specified document.

A stylesheet parameter is the definition of a global variable declared using xsl:param as a child of the xsl:stylesheet or xsl:transform element in the transformation.

The parametername is the local name of the parameter to be set. The parameter is assumed to have no namespace. An external variable declared with a namespace can be referred to with the syntax {namespace}localname. If no external variable is found with the specified name, then this parameter is ignored.

document isa path or URI to an XML document.

!parameter=value=value

Sets a serialization parameter.

Serialization parameters define how the result of the query is serialized. This is equivalent to adding the following declarations to the query:

 
              
              declare namespace serialization="http://www.xmlprime.com/serialization";
              declare option serialization:parameter "value";
            
 

If the requested serialization parameter does not exist this parameter is ignored. If a parameter is also set in the query, then the value passed on the command line takes precedence.

For a detailed description of all the available serialization parameters, see Serialization parameters.