Stylesheet compilation

Before a stylesheet can be processed, it must be converted into some internal machine readable format. Usually the stylesheet is read into memory using an XML parser, translated into machine format and then preserved in memory for repeated use. This is called stylesheet compilation.

Different XSLT processors implement stylesheet compilation differently, so JAXP includes the javax.xml.transform.Templates interface to provide consistency. The newTransformer() method of this interface is widely used. It allows you to obtain a new instance of a class that implements the Transformer interface. It is this Transformer object that actually allows you to perform XSLT transformations. Since the implementation of the Templates interface is hidden by JAXP, it must be created by the following method on javax.xml.transform.TransformerFactory:

public Template newTemplates(Source source) throws TransformeConfigurationException

As mentioned earlier, the Source may obtain the XSLT stylesheet from one of many locations, including a filename, a system identifier, or even a DOM tree. Regardless of the original location, the XSLT processor is supposed to compile the stylesheet into an optimized internal representation.

68 The XML Files: Development of XML/XSL Applications Using WebSphere Studio

Page 84
Image 84
IBM Version 5 manual Stylesheet compilation