Package net.sf.saxon.expr.instruct
Class LocalParam
- java.lang.Object
-
- net.sf.saxon.expr.instruct.GeneralVariable
-
- net.sf.saxon.expr.instruct.LocalParam
-
- All Implemented Interfaces:
javax.xml.transform.SourceLocator
,Binding
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
.The LocalParam class is also used to represent parameters with the saxon:iterate instruction
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.instruct.GeneralVariable
evaluationMode, referenceCount, requiredType, select, slotNumber, variableQName
-
-
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.Expression
getConversion()
Get the conversion expressionint
getConversionEvaluationMode()
int
getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposesIntegerValue[]
getIntegerBoundsForVariable()
If the variable is bound to an integer, get the minimum and maximum possible values.int
getParameterId()
Get the parameter id, which is essentially an alias for the parameter name, unique within a stylesheetjava.util.Iterator<Expression>
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.expr.instruct.GeneralVariable
addReference, checkAgainstRequiredType, computeEvaluationMode, copy, getCardinality, getColumnNumber, getContainer, getEvaluationMode, getExecutable, getLineNumber, getLocalSlotNumber, getLocationId, getLocationProvider, getPublicId, getRequiredType, getSelectExpression, getSelectValue, getSlotNumber, getSystemId, getSystemId, getVariableQName, init, isAssignable, isGlobal, isImplicitlyRequiredParam, isRequiredParam, isTunnelParam, optimize, setAssignable, setContainer, setImplicitlyRequiredParam, setLocationId, setReferenceCount, setRequiredParam, setRequiredType, setSelectExpression, setSlotNumber, setTunnel, setVariableQName, simplify, typeCheck
-
-
-
-
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. The argument can be null to indicate that no conversion is required.
-
getConversion
public Expression getConversion()
Get the conversion expression- Returns:
- the expression used to convert the value to the required type, or null if there is none
-
getConversionEvaluationMode
public int getConversionEvaluationMode()
-
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<Expression> 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 over all the contained expressions (in practice, the select 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- Parameters:
context
- the dynamic context- Returns:
- either null if processing is complete, or a tailcall if one is left outstanding
- Throws:
XPathException
- if a dynamic error occurs in the evaluation
-
getIntegerBoundsForVariable
public IntegerValue[] getIntegerBoundsForVariable()
If the variable is bound to an integer, get the minimum and maximum possible values. Return null if unknown or not applicable- Specified by:
getIntegerBoundsForVariable
in interfaceBinding
- Overrides:
getIntegerBoundsForVariable
in classGeneralVariable
- Returns:
- a pair of integers containing the minimum and maximum values for the integer value; or null if the value is not an integer or the range is unknown
-
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 object used to present the output
-
-