Transform

This operation causes the buffer to be transformed using a provided XSLT stylesheet.

Railroad diagram for grammar entity Transform in Xoom Processor.

Transform
         ::= ( '#' | '%' ) ( '=:' ParameterName '=' ParameterValue )* XsltFile

The option of using either # or % exists because in various shells and scripting languages comments can be denoted by either of the two characters. The operation transforms the buffer using the XSLT stylesheet specified by XsltFile.

Ordinarily, the output of the transformation must be valid XML (this includes XHTML) but need not be XoomXML. When the output is XML, the result of the transformation is returned to the buffer.

Output can also be HTML or a text file, provided the XSLT in question correctly declares the result type. In these cases the output, which is not valid XML, can only be saved to a file or printed to the console and hence can't be used in further processing. This is because the buffer can only contain valid XML.

Some XSLT stylesheets take parameters. If appropriate, parameters should be provided in the way indicated by the syntax diagram.

Transforming configuration

xp zeus:All % t.xsl zeus-all-transformed.xml

Retrieves the All named query from the Xoom server zeus, transforms the result using the XSLT stylesheet in the file named t.xsl and saves the result to a file named zeus-all-transformed.xml.

Multiple transformations

xp : default.xml % t1.xsl default-t1.xml % t2.xsl default-t1-t2.xml

Retrieves the DEFAULT named query from the local Xoom server, saves the result to a file named default.xml, then transforms the result using the XSLT stylesheet in the file named t1.xsl, saves the result of the transformation to a file named default-t1.xml, then applies a second transformation using the XSLT stylesheet in the file named t2.xsl and saves the twice-transformed result to a file named default-t1-t2.xml.

XSLT parameter

xp source.xml % =:ParName1=Val1 t.xsl r.xml
Transforms the contents of source.xml using the XSLT stylesheet t.xsl, with the parameter ParName1 set to Val1. The result of the transformation is saved in r.xml.

As many parameters as required can be specified in this way.

XSLT parameter with spaces in its value

If the parameter value requires spaces, enclose the whole parameter declaration in double quotes, , starting from =:. For example:
xp source.xml % "=:ParWithSpaces=Parameter value with spaces" t.xsl