| java.lang.Object net.sf.saxon.expr.ComputedExpression net.sf.saxon.instruct.Instruction
All known Subclasses: net.sf.saxon.instruct.Doctype, net.sf.saxon.instruct.ApplyImports, net.sf.saxon.instruct.SimpleNodeConstructor, net.sf.saxon.instruct.ParentNodeConstructor, net.sf.saxon.instruct.While, net.sf.saxon.instruct.Block, net.sf.saxon.instruct.CallTemplate, net.sf.saxon.instruct.Choose, net.sf.saxon.instruct.GeneralVariable, net.sf.saxon.instruct.ApplyTemplates, net.sf.saxon.instruct.CopyOf, net.sf.saxon.instruct.ForEach, net.sf.saxon.instruct.ResultDocument, net.sf.saxon.instruct.TraceWrapper, net.sf.saxon.instruct.Message, net.sf.saxon.instruct.ForEachGroup, net.sf.saxon.instruct.UseAttributeSets, net.sf.saxon.instruct.AnalyzeString,
Instruction | abstract public class Instruction extends ComputedExpression implements SourceLocator,TailCallReturner(Code) | | Abstract superclass for all instructions in the compiled stylesheet.
This represents a compiled instruction, and as such, the minimum information is
retained from the original stylesheet.
Note: this class implements SourceLocator: that is, it can identify where in the stylesheet
the source instruction was located.
|
Method Summary | |
public static void | appendItem(Item it, SequenceReceiver out, int locationId) Static method to append an item that results from evaluating an expression to the current
result receiver. | protected static ParameterSet | assembleParams(XPathContext context, WithParam[] actualParams) Assemble a ParameterSet. | protected static ParameterSet | assembleTunnelParams(XPathContext context, WithParam[] actualParams) Assemble a ParameterSet. | public int | computeCardinality() | public int | computeSpecialProperties() Get the static properties of this expression (other than its type). | public boolean | createsNewNodes() Determine whether this instruction creates new nodes. | protected static XPathException | dynamicError(SourceLocator loc, XPathException error, XPathContext context) Construct an exception with diagnostic information. | final public String | evaluateAsString(XPathContext context) Evaluate an expression as a String. | public Item | evaluateItem(XPathContext context) Evaluate an expression as a single item. | public int | getImplementationMethod() An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
This method indicates which of these methods is prefered. | public InstructionInfo | getInstructionInfo() | public int | getInstructionNameCode() | public ItemType | getItemType(TypeHierarchy th) | public SourceLocator | getSourceLocator() | public boolean | isXSLT(XPathContext context) | public SequenceIterator | iterate(XPathContext context) Return an Iterator to iterate over the values of a sequence. | public void | process(XPathContext context) | abstract public TailCall | processLeavingTail(XPathContext context) ProcessLeavingTail: called to do the real work of this instruction. | public Expression | promote(PromotionOffer offer) Offer promotion for this subexpression. | protected void | promoteInst(PromotionOffer offer) Handle promotion offers, that is, non-local tree rewrites. | abstract public Expression | simplify(StaticContext env) Simplify an expression. |
Instruction | public Instruction()(Code) | | Constructor
|
appendItem | public static void appendItem(Item it, SequenceReceiver out, int locationId) throws XPathException(Code) | | Static method to append an item that results from evaluating an expression to the current
result receiver. The method checks to see whether the item returned from the expression is
actually a function-call-package representing the result of a tail call optimization; if so,
the tail function calls are complete and the final result is passed on.
Parameters: it - the item: possibly a FunctionCallPackage Parameters: out - the Receiver throws: XPathException - |
assembleParams | protected static ParameterSet assembleParams(XPathContext context, WithParam[] actualParams) throws XPathException(Code) | | Assemble a ParameterSet. Method used by instructions that have xsl:with-param
children. This method is used for the non-tunnel parameters.
|
assembleTunnelParams | protected static ParameterSet assembleTunnelParams(XPathContext context, WithParam[] actualParams) throws XPathException(Code) | | Assemble a ParameterSet. Method used by instructions that have xsl:with-param
children. This method is used for the tunnel parameters.
|
computeCardinality | public int computeCardinality()(Code) | | Get the cardinality of the sequence returned by evaluating this instruction
the static cardinality |
computeSpecialProperties | public int computeSpecialProperties()(Code) | | Get the static properties of this expression (other than its type). The result is
bit-signficant. These properties are used for optimizations. In general, if
property bit is set, it is true, but if it is unset, the value is unknown.
a set of flags indicating static properties of this expression |
createsNewNodes | public boolean createsNewNodes()(Code) | | Determine whether this instruction creates new nodes.
This implementation returns a default value of false
|
dynamicError | protected static XPathException dynamicError(SourceLocator loc, XPathException error, XPathContext context)(Code) | | Construct an exception with diagnostic information. Note that this method
returns the exception, it does not throw it: that is up to the caller.
Parameters: error - The exception containing information about the error Parameters: context - The controller of the transformation an exception based on the supplied exception, but with location informationadded relating to this instruction |
evaluateAsString | final public String evaluateAsString(XPathContext context) throws XPathException(Code) | | Evaluate an expression as a String. This function must only be called in contexts
where it is known that the expression will return a single string (or where an empty sequence
is to be treated as a zero-length string). Implementations should not attempt to convert
the result to a string, other than converting () to "". This method is used mainly to
evaluate expressions produced by compiling an attribute value template.
exception: net.sf.saxon.trans.XPathException - if any dynamic error occurs evaluating theexpression exception: java.lang.ClassCastException - if the result type of theexpression is not xs:string? Parameters: context - The context in which the expression is to be evaluated the value of the expression, evaluated in the current context.The expression must return a string or (); if the value of theexpression is (), this method returns "". |
evaluateItem | public Item evaluateItem(XPathContext context) throws XPathException(Code) | | Evaluate an expression as a single item. This always returns either a single Item or
null (denoting the empty sequence). No conversion is done. This method should not be
used unless the static type of the expression is a subtype of "item" or "item?": that is,
it should not be called if the expression may return a sequence. There is no guarantee that
this condition will be detected.
Parameters: context - The context in which the expression is to be evaluated exception: XPathException - if any dynamic error occurs evaluating theexpression the node or atomic value that results from evaluating theexpression; or null to indicate that the result is an emptysequence |
getImplementationMethod | public int getImplementationMethod()(Code) | | An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
This method indicates which of these methods is prefered. For instructions this is the process() method.
|
getInstructionNameCode | public int getInstructionNameCode()(Code) | | Get the namecode of the instruction for use in diagnostics
|
getItemType | public ItemType getItemType(TypeHierarchy th)(Code) | | Get the item type of the items returned by evaluating this instruction
the static item type of the instruction Parameters: th - |
getSourceLocator | public SourceLocator getSourceLocator()(Code) | | Get a SourceLocator identifying the location of this instruction
|
isXSLT | public boolean isXSLT(XPathContext context)(Code) | | Establish whether this is an XSLT instruction or an XQuery instruction
(used to produce appropriate diagnostics)
Parameters: context - true for XSLT, false for XQuery |
iterate | public SequenceIterator iterate(XPathContext context) throws XPathException(Code) | | Return an Iterator to iterate over the values of a sequence. The value of every
expression can be regarded as a sequence, so this method is supported for all
expressions. This default implementation handles iteration for expressions that
return singleton values: for non-singleton expressions, the subclass must
provide its own implementation.
exception: XPathException - if any dynamic error occurs evaluating theexpression Parameters: context - supplies the context for evaluation a SequenceIterator that can be used to iterate over the resultof the expression |
process | public void process(XPathContext context) throws XPathException(Code) | | Process the instruction, without returning any tail calls
Parameters: context - The dynamic context, giving access to the current node,the current variables, etc. |
processLeavingTail | abstract public TailCall processLeavingTail(XPathContext context) throws XPathException(Code) | | ProcessLeavingTail: called to do the real work of this instruction. This method
must be implemented in each subclass. The results of the instruction are written
to the current Receiver, which can be obtained via the Controller.
Parameters: context - The dynamic context of the transformation, giving access to the current node,the current variables, etc. null if the instruction has completed execution; or a TailCall indicatinga function call or template call that is delegated to the caller, to be made after the stack hasbeen unwound so as to save stack space. |
promote | public Expression promote(PromotionOffer offer) throws XPathException(Code) | | Offer promotion for this subexpression. The offer will be accepted if the subexpression
is not dependent on the factors (e.g. the context item) identified in the PromotionOffer.
This method is always called at compile time.
Parameters: offer - details of the offer, for example the offer to moveexpressions that don't depend on the context to an outer level inthe containing expression exception: net.sf.saxon.trans.XPathException - if any error is detected if the offer is not accepted, return this expression unchanged.Otherwise return the result of rewriting the expression to promotethis subexpression |
|
|