net.sf.saxon.instruct

Class LocalParam

Implemented Interfaces:
Binding, Serializable, SourceLocator, EvaluableItem, InstructionInfoProvider, SequenceIterable, TailCallReturner

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.

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, PROCESS_METHOD, locationId, staticProperties

Method Summary

ValueRepresentation
evaluateVariable(XPathContext c)
Evaluate the variable
void
explain(ExpressionPresenter out)
Diagnostic print of expression structure.
int
getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes
int
getParameterId()
Get the parameter id, which is essentially an alias for the parameter name, unique within a stylesheet
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 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
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, explain, getCardinality, getEvaluationMode, getInstructionNameCode, getItemType, getLocalSlotNumber, getRequiredType, getSelectExpression, getSelectValue, getSlotNumber, getVariableQName, init, isAssignable, isGlobal, isImplicitlyRequiredParam, isRequiredParam, isTunnelParam, iterate, iterateSubExpressions, optimize, promoteInst, replaceSubExpression, 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, evaluateItem, getImplementationMethod, getInstructionInfo, getInstructionNameCode, getItemType, getSourceLocator, isXSLT, iterate, process, processLeavingTail, promote, promoteInst, simplify

Methods inherited from class net.sf.saxon.expr.Expression

addToPathMap, adoptChildExpression, checkPermittedContents, computeCardinality, computeDependencies, computeSpecialProperties, computeStaticProperties, copy, display, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, explain, explain, findParentOf, getCardinality, getColumnNumber, getConstructType, getContainer, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getItemType, getLineNumber, getLocationId, getLocationProvider, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasLoopingSubexpression, implementsStaticTypeCheck, iterate, iterateEvents, iterateSubExpressions, markTailFunctionCalls, optimize, process, promote, replaceSubExpression, resetLocalStaticProperties, setContainer, setFiltered, setFlattened, setLocationId, simplify, staticTypeCheck, suppressValidation, toString, typeCheck, typeError

Method Details

evaluateVariable

public ValueRepresentation evaluateVariable(XPathContext c)
Evaluate the variable
Specified by:
evaluateVariable in interface Binding

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 interface GeneralVariable

getInstructionNameCode

public int getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes
Overrides:
getInstructionNameCode in interface GeneralVariable

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

iterateSubExpressions

public 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 interface GeneralVariable

processLeavingTail

public TailCall processLeavingTail(XPathContext context)
            throws XPathException
Process the local parameter declaration
Specified by:
processLeavingTail in interface TailCallReturner
Overrides:
processLeavingTail in interface Instruction

replaceSubExpression

public boolean replaceSubExpression(Expression original,
                                    Expression replacement)
Replace one subexpression by a replacement subexpression
Overrides:
replaceSubExpression in interface GeneralVariable
Parameters:
original - the original subexpression
replacement - the replacement subexpression
Returns:
true if the original subexpression is found

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.

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