Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
net.sf.saxon.expr.Expression
net.sf.saxon.instruct.Instruction
net.sf.saxon.instruct.CallTemplate
public class CallTemplate
extends Instruction
Field Summary |
Fields inherited from class net.sf.saxon.expr.Expression | |
EVALUATE_METHOD , ITERATE_METHOD , PROCESS_METHOD , locationId , staticProperties |
Constructor Summary | |
|
Method Summary | |
int |
|
Expression |
|
boolean |
|
void |
|
InstructionInfo |
|
int |
|
int | |
ItemType |
|
Template |
|
Iterator |
|
Expression |
|
void |
|
TailCall |
|
protected void |
|
boolean |
|
void |
|
Expression |
|
Expression |
|
Methods inherited from class net.sf.saxon.instruct.Instruction | |
assembleParams , assembleTunnelParams , computeCardinality , computeSpecialProperties , createsNewNodes , dynamicError , evaluateAsString , evaluateItem , getImplementationMethod , getInstructionInfo , getInstructionNameCode , getItemType , getSourceLocator , isXSLT , iterate , process , processLeavingTail , promote , promoteInst , simplify |
public CallTemplate(Template template, boolean useTailRecursion, Expression calledTemplateExpression, NamespaceResolver nsContext)
Construct a CallTemplate instruction.
- Parameters:
template
- the Template object identifying the template to be called, in the normal case where this is known staticallyuseTailRecursion
- true if the call is potentially tail recursivecalledTemplateExpression
- expression to calculate the name of the template to be called at run-time, this supports the saxon:allow-avt optionnsContext
- the static namespace context of the instruction, needed only in the case where the name of the called template is to be calculated dynamically
public int computeCardinality()
Get the cardinality of the sequence returned by evaluating this instruction
- Overrides:
- computeCardinality in interface Instruction
- Returns:
- the static cardinality
public Expression copy()
Copy an expression. This makes a deep copy.
- Overrides:
- copy in interface Expression
- Returns:
- the copy of the original expression
public final boolean createsNewNodes()
Determine whether this instruction creates new nodes. This implementation currently returns true unconditionally.
- Overrides:
- createsNewNodes in interface Instruction
public void explain(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
- Overrides:
- explain in interface Expression
public InstructionInfo getInstructionInfo()
Set additional trace properties appropriate to the kind of instruction. This implementation adds the template property, which identities the template to be called
- Specified by:
- getInstructionInfo in interface InstructionInfoProvider
- Overrides:
- getInstructionInfo in interface Instruction
public int getInstructionNameCode()
Return the name of this instruction.
- Overrides:
- getInstructionNameCode in interface Instruction
public int getIntrinsicDependencies()
- Overrides:
- getIntrinsicDependencies in interface Expression
public ItemType getItemType(TypeHierarchy th)
Get the item type of the items returned by evaluating this instruction
- Overrides:
- getItemType in interface Instruction
- Parameters:
th
- the type hierarchy cache
- Returns:
- the static item type of the instruction
public Template getTargetTemplate(XPathContext context) throws XPathException
Get the template, in the case where it is specified dynamically.
- Parameters:
context
- The dynamic context of the transformation
- Returns:
- The template to be called
- Throws:
XPathException
- if a dynamic error occurs: specifically, if the template name is computed at run-time (Saxon extension) and the name is invalid or does not reference a known template
public Iterator iterateSubExpressions()
Get all the XPath expressions associated with this instruction (in XSLT terms, the expression present on attributes of the instruction, as distinct from the child instructions in a sequence construction)
- Overrides:
- iterateSubExpressions in interface Expression
public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException
- Overrides:
- optimize in interface Expression
public void process(XPathContext context) throws XPathException
Process this instruction, without leaving any tail calls.
- Overrides:
- process in interface Instruction
- Parameters:
context
- the dynamic context for this transformation
- Throws:
XPathException
- if a dynamic error occurs
public TailCall processLeavingTail(XPathContext context) throws XPathException
Process this instruction. If the called template contains a tail call (which may be an xsl:call-template of xsl:apply-templates instruction) then the tail call will not actually be evaluated, but will be returned in a TailCall object for the caller to execute.
- Specified by:
- processLeavingTail in interface TailCallReturner
- Overrides:
- processLeavingTail in interface Instruction
- Parameters:
context
- the dynamic context for this transformation
- Returns:
- an object containing information about the tail call to be executed by the caller. Returns null if there is no tail call.
protected void promoteInst(PromotionOffer offer) throws XPathException
Handle promotion offers, that is, non-local tree rewrites.
- Overrides:
- promoteInst in interface Instruction
- Parameters:
offer
- The type of rewrite being offered
- Throws:
XPathException
-
public boolean replaceSubExpression(Expression original, Expression replacement)
Replace one subexpression by a replacement subexpression
- Overrides:
- replaceSubExpression in interface Expression
- Parameters:
original
- the original subexpressionreplacement
- the replacement subexpression
- Returns:
- true if the original subexpression is found
public void setActualParameters(WithParam[] actualParams, WithParam[] tunnelParams)
Set the actual parameters on the call
- Parameters:
actualParams
- the parameters that are not tunnel parameterstunnelParams
- the tunnel parameters
public Expression simplify(ExpressionVisitor visitor) throws XPathException
Simplify an expression. This performs any static optimization (by rewriting the expression as a different expression).
- Overrides:
- simplify in interface Instruction
- Parameters:
visitor
- an expression visitor
- Returns:
- the simplified expression
- Throws:
XPathException
- if an error is discovered during expression rewriting
public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException
- Overrides:
- typeCheck in interface Expression