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:
SourceLocator
,Binding
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 -
Method Summary
Modifier and TypeMethodDescriptionEvaluate the variablevoid
Diagnostic print of expression structure.Get the conversion expressionint
int
Get the name of this instruction for diagnostic and tracing purposesIf the variable is bound to an integer, get the minimum and maximum possible values.int
Get the parameter id, which is essentially an alias for the parameter name, unique within a stylesheetGet 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)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 stylesheetMethods 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
-
Constructor Details
-
LocalParam
public LocalParam()
-
-
Method Details
-
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
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
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
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
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
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
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
Evaluate the variable- Parameters:
c
- the XPath dynamic evaluation context- Returns:
- the result of evaluating the variable
-
explain
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
-