The XML Style Sheet Translation (XSLT) APIs

In this section, you will learn about the XML Style Sheet Translation(XSLT)APIs.



The XML Style Sheet Translation (XSLT) APIs


The XSLT Packages








The XSLT APIs are defined in the following packages:

Package Description
javax.xml.transform Defines the TransformerFactory and Transformer  classes. These classes are  used to get a object for doing transformations. After creating a transformer object,  its transform() method is invoked. This method provides an input (source) and output (result).
javax.xml.transform.dom Defines classes used  to create input and output  objects from a DOM.
javax.xml.transform.sax Defines classes used to create input  from a SAX parser and output objects from a SAX event handler. Defines classes used to create input  and output  objects from an I/O stream.

The diagram  shows the working of the XSLT APIs .

A TransformerFactory object is instantiated, and used to create a Transformer. The source (input) object acts as the input to the transformation process. This object is created from SAX reader, from a DOM, or from an input stream.

The output (result) object is the result of this transformation process. This object can be a SAX event handler, a DOM, or an output stream. Transformer is created from a set of transformation instructions. If it is created without any specific instructions, then the transformer object simply copies the source to the result.