This package provides classes used during the compilation of an XSLT stylesheet.


Interface Summary
CollationDeclaration Interface implemented by SaxonCollation, which is not available in Saxon-HE
StylesheetProcedure This interface is implemented by all XSL elements that can contain local variable declarations.
XSLTStaticContext Extends the standard XPath static context with information that is available for XPath expressions invoked from XSLT

Class Summary
AbsentExtensionElement This element is a surrogate for an extension element (or indeed an xsl element) for which no implementation is available.
AttributeValueTemplate This class represents an attribute value template.
DataElement This element represents a top-level element in a user-defined namespace, or a child/descendant of such an element.
Declaration The object represents a declaration (that is, a top-level element) in a stylesheet.
ExpressionContext An ExpressionContext represents the context for an XPath expression written in the stylesheet.
ExtensionInstruction Abstract class representing an extension instruction
LiteralResultElement This class represents a literal result element in the style sheet (typically an HTML element to be output).
PrincipalStylesheetModule Represents the stylesheet module at the root of the import tree, that is, the module that includes or imports all the others.
StyleElement Abstract superclass for all element nodes in the stylesheet.
StyleNodeFactory Class StyleNodeFactory.
StylesheetFunctionLibrary A StylesheetFunctionLibrary contains functions defined by the user in a stylesheet.
StylesheetModule A stylesheet module represents a module of a stylesheet.
StylesheetStripper The StylesheetStripper refines the Stripper class to do stripping of whitespace nodes on a stylesheet.
UseWhenFilter This is a filter inserted into the input pipeline for processing stylesheet modules, whose task is to evaluate use-when expressions and discard those parts of the stylesheet module for which the use-when attribute evaluates to false.
UseWhenStaticContext This class implements the static context used for evaluating use-when expressions in XSLT 2.0 A new instance of this class is created for each use-when expression encountered; there are therefore no issues with reusability.
XSLAnalyzeString An xsl:analyze-string elements in the stylesheet.
XSLApplyImports An xsl:apply-imports element in the stylesheet
XSLApplyTemplates An xsl:apply-templates element in the stylesheet
XSLAttribute xsl:attribute element in stylesheet.
XSLAttributeSet An xsl:attribute-set element in the stylesheet.
XSLCallTemplate An xsl:call-template element in the stylesheet
XSLCharacterMap An xsl:character-map declaration in the stylesheet.
XSLChoose An xsl:choose elements in the stylesheet.
XSLComment An xsl:comment elements in the stylesheet.
XSLCopy Handler for xsl:copy elements in stylesheet.
XSLCopyOf An xsl:copy-of element in the stylesheet.
XSLDecimalFormat Handler for xsl:decimal-format elements in stylesheet.
XSLDocument An xsl:document instruction in the stylesheet.
XSLElement An xsl:element element in the stylesheet.
XSLFallback xsl:fallback element in stylesheet.
XSLForEach Handler for xsl:for-each elements in stylesheet.
XSLForEachGroup Handler for xsl:for-each-group elements in stylesheet.
XSLFunction Handler for xsl:function elements in stylesheet (XSLT 2.0).
XSLGeneralIncorporate Abstract class to represent xsl:include or xsl:import element in the stylesheet.
XSLGeneralVariable This class defines common behaviour across xsl:variable, xsl:param, and xsl:with-param
XSLIf Handler for xsl:if elements in stylesheet.
XSLImport xsl:import element in the stylesheet.
XSLImportSchema Compile-time representation of an xsl:import-schema declaration in a stylesheet
XSLInclude xsl:include element in the stylesheet.
XSLKey Handler for xsl:key elements in stylesheet.
XSLLeafNodeConstructor Common superclass for XSLT elements whose content template produces a text value: xsl:text, xsl:value-of, xsl:attribute, xsl:comment, and xsl:processing-instruction
XSLMatchingSubstring Handler for xsl:matching-substring and xsl:non-matching-substring elements in stylesheet.
XSLMessage An xsl:message element in the stylesheet.
XSLNamespace An xsl:namespace element in the stylesheet.
XSLNamespaceAlias An xsl:namespace-alias element in the stylesheet.
XSLNextMatch An xsl:next-match element in the stylesheet
XSLNumber An xsl:number element in the stylesheet.
XSLOtherwise Handler for xsl:otherwise elements in stylesheet.
XSLOutput An xsl:output element in the stylesheet.
XSLOutputCharacter An xsl:output-character element in the stylesheet.
XSLParam An xsl:param element in the stylesheet.
XSLPerformSort Handler for xsl:perform-sort elements in stylesheet (XSLT 2.0).
XSLPreserveSpace An xsl:preserve-space or xsl:strip-space elements in stylesheet.
XSLProcessingInstruction An xsl:processing-instruction element in the stylesheet.
XSLResultDocument An xsl:result-document element in the stylesheet.
XSLSequence An xsl:sequence element in the stylesheet.
XSLSort An xsl:sort element in the stylesheet.
XSLStylesheet An xsl:stylesheet or xsl:transform element in the stylesheet.
XSLTemplate An xsl:template element in the style sheet.
XSLText Handler for xsl:text elements in stylesheet.
XSLValueOf An xsl:value-of element in the stylesheet.
XSLVariable Handler for xsl:variable elements in stylesheet.
XSLVariableDeclaration Generic class for xsl:variable and xsl:param elements.
XSLWhen Handler for xsl:when elements in stylesheet.
XSLWithParam An xsl:with-param element in the stylesheet.

Package Description

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.

Michael H. Kay
Saxonica Limited
9 February 2005

Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.