Package net.sf.saxon.instruct
Class LocalParam
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.instruct.Instruction
-
- net.sf.saxon.instruct.GeneralVariable
-
- net.sf.saxon.instruct.LocalParam
-
- All Implemented Interfaces:
java.io.Serializable
,javax.xml.transform.SourceLocator
,LocationProvider
,SaxonLocator
,Binding
,EvaluableItem
,SequenceIterable
,TailCallReturner
,InstructionInfo
,org.xml.sax.Locator
public final class LocalParam extends GeneralVariable
The compiled form of an xsl:param element within a template in an XSLT stylesheet.The xsl:param element in XSLT has mandatory attribute name and optional attribute select. It can also be specified as required="yes" or required="no".
This is used only for parameters to XSLT templates. For function calls, the caller of the function places supplied arguments onto the callee's stackframe and the callee does not need to do anything. Global parameters (XQuery external variables) are handled using
GlobalParam
.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.instruct.GeneralVariable
evaluationMode, referenceCount, slotNumber, variableQName
-
Fields inherited from class net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, locationId, PROCESS_METHOD, staticProperties
-
-
Constructor Summary
Constructors Constructor Description LocalParam()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueRepresentation
evaluateVariable(XPathContext c)
Evaluate the variablevoid
explain(ExpressionPresenter out)
Diagnostic print of expression structure.int
getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposesint
getParameterId()
Get the parameter id, which is essentially an alias for the parameter name, unique within a stylesheetjava.util.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)TailCall
processLeavingTail(XPathContext context)
Process the local parameter declarationboolean
replaceSubExpression(Expression original, Expression replacement)
Replace one subexpression by a replacement subexpressionvoid
setConversion(Expression convertor)
Define a conversion that is to be applied to the supplied parameter value.void
setParameterId(int id)
Allocate a number which is essentially an alias for the parameter name, unique within a stylesheet-
Methods inherited from class net.sf.saxon.instruct.GeneralVariable
copy, evaluateItem, getCardinality, getEvaluationMode, getItemType, getLocalSlotNumber, getRequiredType, getSelectExpression, getSelectValue, getSlotNumber, getVariableQName, init, isAssignable, isGlobal, isImplicitlyRequiredParam, isRequiredParam, isTunnelParam, iterate, optimize, promoteInst, setAssignable, setImplicitlyRequiredParam, setReferenceCount, setRequiredParam, setRequiredType, setSelectExpression, setSlotNumber, setTunnel, setVariableQName, simplify, typeCheck
-
Methods inherited from class net.sf.saxon.instruct.Instruction
assembleParams, assembleTunnelParams, computeCardinality, computeSpecialProperties, createsNewNodes, dynamicError, evaluateAsString, getConstructType, getImplementationMethod, getSourceLocator, isXSLT, process, promote
-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, display, doPromotion, dynamicError, effectiveBooleanValue, evaluatePendingUpdates, explain, findParentOf, getColumnNumber, getColumnNumber, getContainer, getDependencies, getExecutable, getHostLanguage, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, getSystemId, hasLoopingSubexpression, implementsStaticTypeCheck, isUpdatingExpression, iterateEvents, markTailFunctionCalls, resetLocalStaticProperties, setContainer, setFiltered, setFlattened, setLocationId, staticTypeCheck, suppressValidation, toString, typeError
-
-
-
-
Method Detail
-
setParameterId
public void setParameterId(int id)
Allocate a number which is essentially an alias for the parameter name, unique within a stylesheet- Parameters:
id
- the parameter id
-
getParameterId
public int getParameterId()
Get the parameter id, which is essentially an alias for the parameter name, unique within a stylesheet- Returns:
- the parameter id
-
setConversion
public void setConversion(Expression convertor)
Define a conversion that is to be applied to the supplied parameter value.- Parameters:
convertor
- The expression to be applied. This performs type checking, and the basic conversions implied by function calling rules, for example numeric promotion, atomization, and conversion of untyped atomic values to a required type. The conversion uses the actual parameter value as input, referencing it using a VariableReference.
-
getInstructionNameCode
public int getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes- Overrides:
getInstructionNameCode
in classGeneralVariable
- Returns:
- the name of this instruction, as a name pool name code
-
iterateSubExpressions
public java.util.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 classGeneralVariable
- Returns:
- an iterator containing the sub-expressions of this expression
-
replaceSubExpression
public boolean replaceSubExpression(Expression original, Expression replacement)
Replace one subexpression by a replacement subexpression- Overrides:
replaceSubExpression
in classGeneralVariable
- Parameters:
original
- the original subexpressionreplacement
- the replacement subexpression- Returns:
- true if the original subexpression is found
-
processLeavingTail
public TailCall processLeavingTail(XPathContext context) throws XPathException
Process the local parameter declaration- Specified by:
processLeavingTail
in interfaceTailCallReturner
- Specified by:
processLeavingTail
in classInstruction
- Parameters:
context
- The dynamic context of the transformation, giving access to the current node, the current variables, etc.- Returns:
- null if the instruction has completed execution; or a TailCall indicating a function call or template call that is delegated to the caller, to be made after the stack has been unwound so as to save stack space.
- Throws:
XPathException
-
evaluateVariable
public ValueRepresentation evaluateVariable(XPathContext c)
Evaluate the variable- Parameters:
c
- the XPath dynamic evaluation context- Returns:
- the result of evaluating the variable
-
explain
public void explain(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Overrides:
explain
in classGeneralVariable
- Parameters:
out
- the expression presenter used to display the structure
-
-