Package net.sf.saxon.style

This package provides classes used during the compilation of an XSLT stylesheet. The instances of these classes are discarded once compilation is complete, and they play no role in executing the transformation at run-time, except when tracing and debugging are invoked.

The class StyleElement represents an element node on the stylesheet tree. Subclasses of StyleElement represent individual stylesheet elements, and are generally named according to the XSLT element name, for example XSLApplyTemplates, XSLChoose. The class XSLStylesheet is used for the xsl:stylesheet element in each stylesheet module, and in particular for the xsl:stylesheet element in the principal stylesheet module.

During construction of the stylesheet tree, the class StyleNodeFactory is nominated to the Builder as the factory class responsible for creating element nodes on the tree. It is this class that decides which subclass of StyleElement to use for each element appearing in the stylesheet. For extension elements, the decision is delegated to a user-created ExtensionElementFactory.

Each class provides a number of methods supporting the various phases of processing. The sequence of events sometimes varies slightly, but in general the first phase is done by prepareAttributes, which performs local validation of the attributes of each instruction. The second phase is represented by the validate method, which does global validation, fixup of references, and type checking. The third phase is done by the compile method, which generates Instruction and Expression objects. Further processing (local and global optimization) is then done on these Instruction objects, and is no longer the responsibility of this package.