## Package net.sf.saxon.instruct

This package provides classes for the compiled representation of the various elements and other instructions found in an XSLT stylesheet.

See:
Description

Interface Summary
Debugger: This interface may be implemented by an external debugging tool
TailCall: Interface representing a Tail Call.
TailCallReturner: This interface represents an expression that is capable of being processed leaving tail calls for the calling instruction to deal with.

Class Summary
AnalyzeString: An xsl:analyze-string element in the stylesheet.
ApplyImports: An xsl:apply-imports element in the stylesheet
ApplyTemplates: An instruction representing an xsl:apply-templates element in the stylesheet
Assign: saxon:assign element in stylesheet.
AttributeCreator: Abstract class for fixed and computed attribute constructor expressions
AttributeSet: The compiled form of an xsl:attribute-set element in the stylesheet.
Bindery: The Bindery class holds information about variables and their values.
Block: Implements an imaginary xsl:block instruction which simply evaluates its contents.
BlockIterator: Iterate over the instructions in the Block, concatenating the result of each instruction into a single combined sequence.
CallTemplate: Instruction representing an xsl:call-template element in the stylesheet.
CallTemplate.CallTemplatePackage: A CallTemplatePackage is an object that encapsulates the name of a template to be called, the parameters to be supplied, and the execution context.
Choose: Compiled representation of an xsl:choose or xsl:if element in the stylesheet.
Comment: An instruction representing an xsl:comment element in the stylesheet.
ComputedAttribute: An instruction derived from an xsl:attribute element in stylesheet, or from an attribute constructor in XQuery, in cases where the attribute name is not known statically
ComputedElement: An instruction representing an xsl:element element in an XSLT stylesheet, or a computed element constructor in XQuery.
Copy: Handler for xsl:copy elements in stylesheet.
CopyOf: An xsl:copy-of element in the stylesheet.
Doctype: A saxon:doctype element in the stylesheet.
DocumentInstr: An instruction to create a document node.
DummyNamespaceResolver: A dummy namespace resolver used when validating QName-valued attributes written to the result tree.
ElementCreator: An instruction that creates an element node.
Executable: A compiled stylesheet or a query in executable form.
FixedAttribute: An instruction derived from an xsl:attribute element in stylesheet, or from an attribute constructor in XQuery.
FixedElement: An instruction that creates an element node whose name is known statically.
ForEach: Handler for xsl:for-each elements in a stylesheet.
ForEachGroup: Handler for xsl:for-each-group elements in stylesheet.
GeneralVariable: This class defines common behaviour across xsl:variable, xsl:param, and xsl:with-param; also saxon:assign
GlobalParam: The compiled form of a global xsl:param element in the stylesheet or an external variable declared in the prolog of a Query.
GlobalParameterSet: A GlobalParameterSet is a set of parameters supplied when invoking a stylesheet or query.
GlobalVariable: A compiled global variable in a stylesheet or query.
Instruction: Abstract superclass for all instructions in the compiled stylesheet.
InstructionDetails: Details about an instruction, used when reporting errors and when tracing
LocalParam: The compiled form of an xsl:param element within a template in an XSLT stylesheet.
LocalVariable: Handler for local xsl:variable elements in stylesheet.
LocationMap: A LocationMap allocates integer codes to (systemId, lineNumber) pairs.
Message: An xsl:message element in the stylesheet.
Namespace: An xsl:namespace element in the stylesheet.
NextMatch: An xsl:next-match element in the stylesheet
NumberInstruction: An xsl:number element in the stylesheet.
ParameterSet: A ParameterSet is a set of parameters supplied when calling a template.
ParentNodeConstructor: An abstract class to act as a common parent for instructions that create element nodes and document nodes.
Procedure: This object represents the compiled form of a user-written function, template, attribute-set, etc (the source can be either an XSLT stylesheet function or an XQuery function).
ProcessingInstruction: An xsl:processing-instruction element in the stylesheet, or a processing-instruction constructor in a query
QuerySimpleContentConstructor: This class implements the rules for an XQuery simple content constructor, which are used in constructing the string value of an attribute node, text node, comment node, etc, from the value of the select expression or the contained sequence constructor.
ResultDocument: The compiled form of an xsl:result-document element in the stylesheet.
SavedNamespaceContext: An object representing a list of Namespaces.
SimpleContentConstructor: This class implements the rules for an XSLT (or XQuery) simple content constructor, which are used in constructing the string value of an attribute node, text node, comment node, etc, from the value of the select expression or the contained sequence constructor.
SimpleNodeConstructor: Common superclass for XSLT instructions whose content template produces a text value: xsl:attribute, xsl:comment, xsl:processing-instruction, xsl:namespace, and xsl:text, and their XQuery equivalents
SlotManager: A SlotManager supports functions, templates, etc: specifically, any executable code that requires a stack frame containing local variables.
Template: An xsl:template element in the style sheet.
TraceExpression: A subclass of TraceWrapper used to trace expressions in XPath and XQuery.
TraceInstruction: A run-time instruction which wraps a real instruction and traces its entry and exit to the TraceListener
TraceWrapper: This class is a tracing wrapper around any expression: it delivers the same result as the wrapped expression, but traces its evaluation to a TraceListener
UseAttributeSets: This instruction corresponds to a use-attribute-sets attribute on a literal result element, xsl:element, or xsl:copy.
UserFunction: This object represents the compiled form of a user-written function (the source can be either an XSLT stylesheet function or an XQuery function).
UserFunctionParameter: Run-time object representing a formal argument to a user-defined function
ValueOf: An xsl:value-of element in the stylesheet.
While: Handler for saxon:while elements in stylesheet.
WithParam: An instruction derived from a xsl:with-param element in the stylesheet.

Exception Summary
TerminationException: An exception thrown by xsl:message terminate="yes".

## Package net.sf.saxon.instruct Description

This package provides classes for the compiled representation of the various elements and other instructions found in an XSLT stylesheet. The same constructs are also used for evaluating similar constructs in XQuery, in particular, expressions that construct new nodes.

Instances of these classes are constructed when the stylesheet or query is compiled. In the case of XSLT, the objects representing the compile-time stylesheet (in package net.sf.saxon.style) can then be discarded and garbage-collected.

The most important class is `Instruction`, which represents an XSLT Instruction. In most cases these instructions have a one-to-one relationship with instructions in the original source XSLT stylesheet, and the names of the subclasses (for example ApplyImports, ApplyTemplates, Choose) reflect this.

In XSLT 1.0, XSLT instructions and XPath expressions were quite distinct, and were evaluated in different ways: XSLT instructions in "push" mode (they were described as "writing to the result tree"), and XPath expressions in "pull" mode (reading from the source tree). This distinction is no longer present in the XSLT 2.0 processing model, and the boundary between the `Instruction` and `Expression` classes is therefore a rather fuzzy one. Both instructions and expressions can now be evaluated in either push or pull mode. Flow-of-control constructs such as conditional expressions and FOR expressions are evaluated in either mode depending on their parent expression.

Michael H. Kay
Saxonica Limited
9 February 2005

Copyright (c) Saxonica Limited. All rights reserved.