Programming XML Transformations
Programming XML transformations involves creating an object instance of the Transformer class. The Transformer object will be responsible for reading the XSLT instructions, reading the XML source document, and producing the output.
The creation of the Transformer object must be done through the TransformerFactory class. The TransformerFactory class can create the Transformer object directly, using the XSLT script as a parameter, or else a Templates object can be created using the XSLT script and then the Transformer object can be created using the Templates object. The second approach has the advantage of convenience and creates a thread-safe implementation of the template class.
The code example shown below uses ...