XSLT Processing

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  User Guide and Reference > XSLT >

XSLT Processing

In the XMLSpy GUI, two types of XSLT transformation are available:

 

The XSL/XQuery | XSL Transformation (F10) command is used for straightforward XML transformations with an XSLT stylesheet to result formats specified and described in the stylesheets.
The XSL/XQuery | XSL-FO Transformation command is used: (i) for transformations of XML to FO to PDF in two steps, and (ii) for one-step transformations of FO to PDF.

 

Specifying the XSLT processor for the transformation

The XSLT engine that will be used for transformations is specified in the XSL section of the Options dialog (screenshot below).

xsl-outp-opts2

The available options are explained in the User Reference section. The engine specified in the XSL section will be used for all XSLT transformations. Note that for the XSL-FO transformation, an additional XSLT engine option is available: the XSLT engine that is packaged with some FO processors. To select this option, select the corresponding radio button at the bottom of the XSL section (see screenshot above).

 

Specifying the FO processor

The FO processor that will be used for transformations of FO to PDF is specified in the text box at the bottom of the XSL section of the Options dialog (screenshot above).

 

XSLT 1.0, 2.0, 3.0 and Altova's XSLT engines

The XSLT version of a stylesheet is specified in the version attribute of the xsl:stylesheet (or xsl:transform) element. XMLSpy contains the built-in Altova XSLT 1.0, Altova XSLT 2.0, and Altova XSLT 3.0 engines, and the appropriate engine is selected according to the value of the version attribute (1.0 or 2.0 or 3.0).

 

XSLT Transformation

The XSLT Transformation (F8) command can be used in the following scenarios:

 

To transform an XML document that is active in the GUI and has an XSLT document assigned to it. If no XSLT document is assigned, you are prompted to make an assignment when you click the XSLT Transformation (F8) command.
To transform an XSLT document that is active in the GUI. On clicking the XSLT Transformation (F8) command, you are prompted for the XML file you wish to process with the active XSLT stylesheet.
To transform project folders and files. Right-click the project folder or file and select the command.

 

Back-mapping

With the Back-mapping feature enabled, XSLT transformations will be carried out so that the result document can be mapped back on to the originating XSLT+XML documents. If you click on a node in the result document, then the XSLT instruction and the XML source data that generated that particular result node will be highlighted. Additionally, if you click on an XSLT instruction or an XML data node, then the corresponding nodes in the other two documents are highlighted. See the XSL/XQuery | Enable Back-Mapping command for details.

 

XSL:FO Transformation

The XSL:FO Transformation command can be used in the following scenarios:

 

To transform an XML document that is active in the GUI and has an XSLT document assigned to it. The XML document will first be transformed to FO using the specified XSLT engine. The FO document will then be processed with the specified FO processor to produce the PDF output. If no XSLT document is assigned, you are prompted to make an assignment when you click the XSL:FO Transformation command.
To transform an FO document to PDF using the specified FO processor.
To transform an XSLT document that is active in the GUI. On clicking the XSL:FO Transformation command, you are prompted for the XML file you wish to process with the active XSLT stylesheet.
To transform project folders and files. Right-click the project folder or file and select the command.

 

For a description of the options in the XSL:FO output dialog, see the User Reference section.

 

Parameters for XSLT

If you are using the Altova XSLT engines, XSLT parameters can be stored in a convenient GUI dialog. All the stored parameters are passed to the XSLT document each time you transform. For more information, see the description of the XSLT Parameters / XQuery Variables command.

 

Batch processing with RaptorXML

RaptorXML is a standalone application that contains Altova's newest XML validator, XSLT engines, and XQuery engines. It can be used from the command line, via a COM interface, in Java programs, and in .NET applications to validate XML documents, transform XML documents using XSLT stylesheets, and execute XQuery documents.

 

XSLT transformation tasks can therefore be automated with the use of RaptorXML. For example, you can create a batch file that calls RaptorXML to transform a set of documents. See the RaptorXML documentation for details.

 


© 2019 Altova GmbH