public class CallTemplate extends Instruction implements ITemplateCall, ComponentInvocation
| Modifier and Type | Class and Description |
|---|---|
static class |
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.
|
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD| Constructor and Description |
|---|
CallTemplate(NamedTemplate template,
StructuredQName calledTemplateName,
boolean useTailRecursion,
boolean inStreamable)
Construct a CallTemplate instruction.
|
| Modifier and Type | Method and Description |
|---|---|
int |
computeCardinality()
Get the cardinality of the sequence returned by evaluating this instruction
|
Expression |
copy(RebindingMap rebindings)
Copy an expression.
|
void |
export(ExpressionPresenter out)
Export of expression structure.
|
WithParam[] |
getActualParams()
Get the actual parameters passed to the called template
|
int |
getBindingSlot()
Get the binding slot to be used.
|
StructuredQName |
getCalledTemplateName()
Get the name (QName) of the template being called
|
Component |
getFixedTarget()
Get the target component if this is known in advance, that is, if the target component
is private or final, or in some other cases such as xsl:original.
|
int |
getInstructionNameCode()
Return the name of this instruction.
|
int |
getIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived
from the dependencies of its subexpressions.
|
ItemType |
getItemType()
Get the item type of the items returned by evaluating this instruction
|
StructuredQName |
getObjectName() |
java.lang.String |
getStreamerName()
Get the (partial) name of a class that supports streaming of this kind of expression
|
SymbolicName |
getSymbolicName()
Get the symbolic name of the template being called.
|
Component |
getTarget() |
NamedTemplate |
getTargetTemplate()
Get the target template
|
WithParam[] |
getTunnelParams()
Get the tunnel parameters passed to the called template
|
boolean |
mayCreateNewNodes()
Determine whether this instruction creates new nodes.
|
java.lang.Iterable<Operand> |
operands()
Get the immediate sub-expressions of this expression, with information about the relationship
of each expression to its parent expression.
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.
|
void |
process(XPathContext context)
Process this instruction, without leaving any tail calls.
|
TailCall |
processLeavingTail(XPathContext context)
Process this instruction.
|
void |
setActualParameters(WithParam[] actualParams,
WithParam[] tunnelParams)
Set the actual parameters on the call
|
void |
setBindingSlot(int slot)
Set the binding slot to be used.
|
void |
setTargetTemplate(NamedTemplate target)
Set the target template
|
Expression |
simplify()
Simplify an expression.
|
java.lang.String |
toShortString()
Produce a short string identifying the expression for use in error messages
|
java.lang.String |
toString()
The toString() method for an expression attempts to give a representation of the expression
in an XPath-like form.
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Perform type checking of an expression and its subexpressions.
|
boolean |
usesTailRecursion()
Ask whether this is a tail call
|
alwaysCreatesNewNodes, assembleParams, assembleTunnelParams, computeSpecialProperties, dynamicError, evaluateAsString, evaluateItem, getConstructType, getExpressionName, getImplementationMethod, getInstructionName, getNetCost, getSourceLocator, isInstruction, isXSLT, iterate, someOperandCreatesNewNodesaddToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeHashCode, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getLocalRetainedStaticContext, getLocation, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, hasCompatibleStaticContext, hashCode, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isCallOnSystemFunction, isIdentical, isLiftable, isMultiThreaded, isSameExpression, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers, verifyParentPointerspublic CallTemplate(NamedTemplate template, StructuredQName calledTemplateName, boolean useTailRecursion, boolean inStreamable)
template - the template to be called. This is provisional, and applies only if the template
is not overridden in another package; the template supplied will be the one with
matching name in the same package. Null in the case of saxon:call-template, and also
in the case where the supplied name is xsl:originalcalledTemplateName - the name of the template to be called; null in the case of saxon:call-template
where this is established dynamicallyuseTailRecursion - true if the call is potentially tail recursive
where the name of the called template is to be calculated dynamicallypublic void setActualParameters(WithParam[] actualParams, WithParam[] tunnelParams)
actualParams - the parameters that are not tunnel parameterstunnelParams - the tunnel parameterspublic StructuredQName getCalledTemplateName()
public SymbolicName getSymbolicName()
getSymbolicName in interface ComponentInvocationpublic Component getTarget()
public Component getFixedTarget()
ComponentInvocationgetFixedTarget in interface ComponentInvocationpublic WithParam[] getActualParams()
getActualParams in interface ITemplateCallpublic WithParam[] getTunnelParams()
getTunnelParams in interface ITemplateCallpublic void setTargetTemplate(NamedTemplate target)
target - the target templatepublic NamedTemplate getTargetTemplate()
public boolean usesTailRecursion()
public int getInstructionNameCode()
getInstructionNameCode in class Instructionpublic void setBindingSlot(int slot)
setBindingSlot in interface ComponentInvocationslot - the offset in the binding vector of the containing package where the target template
can be found.public int getBindingSlot()
getBindingSlot in interface ComponentInvocationpublic Expression simplify() throws XPathException
simplify in class ExpressionXPathException - if an error is discovered during expression
rewritingpublic Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
ExpressionThis checks statically that the operands of the expression have the correct type; if necessary it generates code to do run-time type checking or type conversion. A static type error is reported only if execution cannot possibly succeed, that is, if a run-time type error is inevitable. The call may return a modified form of the expression.
This method is called after all references to functions and variables have been resolved to the declaration of the function or variable. However, the types of such functions and variables may not be accurately known if they have not been explicitly declared.
typeCheck in class Expressionvisitor - an expression visitorcontextInfo - Information available statically about the context item: whether it is (possibly)
absent; its static type; its streaming posture.XPathException - if an error is discovered during this phase
(typically a type error)public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
ExpressionThis method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.
optimize in class Expressionvisitor - an expression visitorcontextItemType - the static type of "." at the point where this expression is invoked.
The parameter is set to null if it is known statically that the context item will be undefined.
If the type of the context item is not known statically, the argument is set to
Type.ITEM_TYPEXPathException - if an error is discovered during this phase
(typically a type error)public int computeCardinality()
computeCardinality in class Instructionpublic ItemType getItemType()
getItemType in class Instructionpublic Expression copy(RebindingMap rebindings)
copy in class Expressionrebindings - public int getIntrinsicDependencies()
ExpressiongetIntrinsicDependencies in class Expressionpublic final boolean mayCreateNewNodes()
mayCreateNewNodes in class Instructionpublic java.lang.Iterable<Operand> operands()
ExpressionIf the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method.
operands in class Instructionpublic void process(XPathContext context) throws XPathException
process in class Instructioncontext - the dynamic context for this transformationXPathException - if a dynamic error occurspublic TailCall processLeavingTail(XPathContext context) throws XPathException
processLeavingTail in interface TailCallReturnerprocessLeavingTail in class Instructioncontext - the dynamic context for this transformationXPathException - if a dynamic error occurs during the evaluation
of the instructionpublic StructuredQName getObjectName()
getObjectName in class Expressionpublic void export(ExpressionPresenter out) throws XPathException
export in interface ExportAgentexport in class Expressionout - the expression presenter used to display the structureXPathException - if the export fails, for example if an expression is found that won't work
in the target environment.public java.lang.String toString()
ExpressionThe toString() method for an expression attempts to give a representation of the expression in an XPath-like form.
For subclasses of Expression that represent XPath expressions, the result should always be a string that parses as an XPath 3.0 expression. The expression produced should be equivalent to the original making certain assumptions about the static context. In general the expansion will make no assumptions about namespace bindings, except that (a) the prefix "xs" is used to refer to the XML Schema namespace, and (b) the default function namespace is assumed to be the "fn" namespace.
In the case of XSLT instructions and XQuery expressions, the toString() method gives an abstracted view of the syntax that is not designed in general to be parseable.
toString in class Expressionpublic java.lang.String toShortString()
ExpressiontoShortString in class Expressionpublic java.lang.String getStreamerName()
ExpressiongetStreamerName in class ExpressionCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.