public final class LocalParam extends Object implements LocalBinding, SourceLocator
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
Modifier and Type | Field and Description |
---|---|
protected int |
evaluationMode |
protected int |
referenceCount |
protected int |
slotNumber |
protected StructuredQName |
variableQName |
Constructor and Description |
---|
LocalParam(PackageData pd) |
Modifier and Type | Method and Description |
---|---|
void |
addReference(boolean isLoopingReference)
Register a variable reference that refers to the variable bound in this expression
|
void |
checkAgainstRequiredType(ExpressionVisitor visitor)
Check the select expression against the required type.
|
void |
computeEvaluationMode() |
Expression |
copy()
Copy an expression.
|
Sequence |
evaluateVariable(XPathContext c)
Evaluate the variable
|
int |
getCardinality()
Get the cardinality of the result of this instruction.
|
int |
getColumnNumber()
Get the column number of the expression
|
Expression |
getConversion()
Get the conversion expression
|
int |
getConversionEvaluationMode() |
int |
getEvaluationMode()
Get the evaluation mode of the variable
|
int |
getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes
|
IntegerValue[] |
getIntegerBoundsForVariable()
If the variable is bound to an integer, get the minimum and maximum possible values.
|
int |
getLineNumber()
Get the line number of the expression
|
int |
getLocalSlotNumber()
If this is a local variable held on the local stack frame, return the corresponding slot number.
|
Location |
getLocationId()
Get the location of the expression
|
String |
getPublicId()
Get the publicId of the module containing the expression (to satisfy the SourceLocator interface)
|
SequenceType |
getRequiredType()
Get the required type of this variable
|
Expression |
getSelectExpression()
Get the expression to which this variable is bound
|
Sequence |
getSelectValue(XPathContext context)
Evaluate the variable.
|
int |
getSlotNumber()
Get the slot number allocated to this variable
|
String |
getSystemId()
Get the systemId of the module containing the expression
|
StructuredQName |
getVariableQName()
Get the name of this variable
|
boolean |
isAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign
extension element.
|
boolean |
isCompatible(LocalParam other)
Check if paramater is compatible with another
|
boolean |
isGlobal()
Indicate whether the binding is local or global.
|
boolean |
isImplicitlyRequiredParam()
Ask whether this variable represents a parameter that is implicitly required, because there is no usable
default value
|
boolean |
isRequiredParam()
Ask whether this variable represents a required parameter
|
boolean |
isTunnelParam()
Ask whether this variable represents a tunnel parameter
|
Iterable<Operand> |
operands(Expression parent)
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)
|
void |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType) |
TailCall |
processLeavingTail(XPathContext context)
Process the local parameter declaration
|
boolean |
replaceSubExpression(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression
|
void |
setConversion(Expression convertor)
Define a conversion that is to be applied to the supplied parameter value.
|
void |
setImplicitlyRequiredParam(boolean requiredParam)
Indicate that this variable represents a parameter that is implicitly required (because there is no
usable default value)
|
void |
setLocationId(Location id)
Set the location on an expression.
|
void |
setReferenceCount(int refCount)
Set the nominal number of references to this variable
|
void |
setRequiredParam(boolean requiredParam)
Indicate that this variable represents a required parameter
|
void |
setRequiredType(SequenceType required)
Set the required type of this variable
|
void |
setSelectExpression(Expression select)
Set the expression to which this variable is bound
|
void |
setSlotNumber(int s)
Set the slot number of this variable
|
void |
setTunnel(boolean tunnel)
Indicate whether this variable represents a tunnel parameter
|
void |
setVariableQName(StructuredQName s)
Set the name of the variable
|
void |
simplify(StaticContext env)
Simplify this variable
|
void |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType) |
protected StructuredQName variableQName
protected int slotNumber
protected int referenceCount
protected int evaluationMode
public LocalParam(PackageData pd)
public void setLocationId(Location id)
id
- the locationpublic final Location getLocationId()
public int getLineNumber()
getLineNumber
in interface SourceLocator
public int getColumnNumber()
getColumnNumber
in interface SourceLocator
public String getSystemId()
getSystemId
in interface SourceLocator
public final String getPublicId()
getPublicId
in interface SourceLocator
public void setSelectExpression(Expression select)
select
- the initializing expressionpublic Expression getSelectExpression()
public void setRequiredType(SequenceType required)
required
- the required typepublic SequenceType getRequiredType()
getRequiredType
in interface Binding
public void setRequiredParam(boolean requiredParam)
requiredParam
- true if this is a required parameterpublic void setImplicitlyRequiredParam(boolean requiredParam)
requiredParam
- true if this is an implicitly required parameterpublic void setTunnel(boolean tunnel)
tunnel
- true if this is a tunnel parameterpublic void setReferenceCount(int refCount)
refCount
- the nominal number of referencespublic int getEvaluationMode()
ExpressionTool
public int getCardinality()
public boolean isAssignable()
Binding
isAssignable
in interface Binding
public boolean isGlobal()
Binding
public int getLocalSlotNumber()
getLocalSlotNumber
in interface LocalBinding
public final boolean isRequiredParam()
public final boolean isImplicitlyRequiredParam()
public final boolean isTunnelParam()
public void simplify(StaticContext env) throws XPathException
env
- the static contextXPathException
- if a failure occurspublic void typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
XPathException
public void optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
XPathException
public void computeEvaluationMode()
public Expression copy()
public void addReference(boolean isLoopingReference)
Binding
addReference
in interface Binding
isLoopingReference
- - true if the reference occurs within a loop, such as the predicate
of a filter expressionpublic void checkAgainstRequiredType(ExpressionVisitor visitor) throws XPathException
visitor
- an expression visitorXPathException
- if the check failspublic Sequence getSelectValue(XPathContext context) throws XPathException
context
- the XPath dynamic contextXPathException
- if evaluation of the select expression fails
with a dynamic errorpublic int getSlotNumber()
public void setSlotNumber(int s)
s
- the slot number, that is, the position allocated to this variable on its stack framepublic void setVariableQName(StructuredQName s)
s
- the name of the variable (a QName)public StructuredQName getVariableQName()
getVariableQName
in interface Binding
public void setConversion(Expression convertor)
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.public Expression getConversion()
public int getConversionEvaluationMode()
public int getInstructionNameCode()
public Iterable<Operand> operands(Expression parent)
public boolean replaceSubExpression(Expression original, Expression replacement)
original
- the original subexpressionreplacement
- the replacement subexpressionpublic TailCall processLeavingTail(XPathContext context) throws XPathException
context
- the dynamic contextXPathException
- if a dynamic error occurs in the evaluationpublic IntegerValue[] getIntegerBoundsForVariable()
getIntegerBoundsForVariable
in interface Binding
public Sequence evaluateVariable(XPathContext c)
evaluateVariable
in interface Binding
c
- the XPath dynamic evaluation contextpublic boolean isCompatible(LocalParam other)
other
- - the LocalParam object to compareCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.