Package net.sf.saxon.expr.instruct
Class WithParam
- java.lang.Object
-
- net.sf.saxon.expr.instruct.WithParam
-
public class WithParam extends java.lang.ObjectAn object derived from a xsl:with-param element in the stylesheet.
-
-
Field Summary
Fields Modifier and Type Field Description static WithParam[]EMPTY_ARRAY
-
Constructor Summary
Constructors Constructor Description WithParam()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static WithParam[]copy(Expression parent, WithParam[] params, RebindingMap rebindings)Static method to copy a set of parametersstatic voidexportParameters(WithParam[] params, ExpressionPresenter out, boolean tunnel)Static method to export a set of parametersstatic voidgatherOperands(Expression parent, WithParam[] params, java.util.List<Operand> list)Static method to gather the XPath expressions used in an array of WithParam parameters (add them to the supplied list)EvaluationModegetEvaluationMode()Get the evaluation mode of the variableintgetInstructionNameCode()SequenceTypegetRequiredType()Get the required type of this variableExpressiongetSelectExpression()Get the expression to which this variable is boundOperandgetSelectOperand()Get the select operandSequencegetSelectValue(XPathContext context)Evaluate the variable.intgetSlotNumber()Get the slot number allocated to this variable.StructuredQNamegetVariableQName()Get the name of this variablebooleanisTypeChecked()Ask whether static type checking has been donestatic voidoptimize(ExpressionVisitor visitor, WithParam[] params, ContextItemStaticInfo contextItemType)Static method to optimize a set of with-param elementsvoidsetRequiredType(SequenceType required)Set the required type of this variablevoidsetSelectExpression(Expression parent, Expression select)Set the expression to which this variable is boundvoidsetSlotNumber(int s)Set the slot number of this variablevoidsetTypeChecked(boolean checked)Say whether this parameter will have been typechecked by the caller to ensure it satisfies the required type, in which case the callee need not do a dynamic type checkvoidsetVariableQName(StructuredQName s)Set the name of the variablestatic voidsimplify(WithParam[] params)Static method to simplify a set of with-param elementsstatic voidtypeCheck(WithParam[] params, ExpressionVisitor visitor, ContextItemStaticInfo contextItemType)Static method to typecheck a set of with-param elements
-
-
-
Field Detail
-
EMPTY_ARRAY
public static WithParam[] EMPTY_ARRAY
-
-
Method Detail
-
setSelectExpression
public void setSelectExpression(Expression parent, Expression select)
Set the expression to which this variable is bound- Parameters:
parent- the parent expressionselect- the initializing expression
-
getSelectOperand
public Operand getSelectOperand()
Get the select operand
-
getSelectExpression
public Expression getSelectExpression()
Get the expression to which this variable is bound- Returns:
- the initializing expression
-
setRequiredType
public void setRequiredType(SequenceType required)
Set the required type of this variable- Parameters:
required- the required type
-
getRequiredType
public SequenceType getRequiredType()
Get the required type of this variable- Returns:
- the required type
-
getSlotNumber
public int getSlotNumber()
Get the slot number allocated to this variable. This is used only for xsl:iterate and xsl:evaluate; template parameters are identified by name, not by slot number.- Returns:
- the slot number, that is the position allocated to the variable on its stack frame
-
setSlotNumber
public void setSlotNumber(int s)
Set the slot number of this variable- Parameters:
s- the slot number, that is, the position allocated to this variable on its stack frame
-
setVariableQName
public void setVariableQName(StructuredQName s)
Set the name of the variable- Parameters:
s- the name of the variable (a QName)
-
getVariableQName
public StructuredQName getVariableQName()
Get the name of this variable- Returns:
- the name of this variable (a QName)
-
setTypeChecked
public void setTypeChecked(boolean checked)
Say whether this parameter will have been typechecked by the caller to ensure it satisfies the required type, in which case the callee need not do a dynamic type check- Parameters:
checked- true if the caller has done static type checking against the required type
-
getInstructionNameCode
public int getInstructionNameCode()
-
simplify
public static void simplify(WithParam[] params) throws XPathException
Static method to simplify a set of with-param elements- Parameters:
params- the set of parameters to be simplified- Throws:
XPathException- if a static error is found
-
typeCheck
public static void typeCheck(WithParam[] params, ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
Static method to typecheck a set of with-param elements- Parameters:
params- the set of parameters to be checkedvisitor- the expression visitorcontextItemType- static information about the context item type and existence- Throws:
XPathException- if a static error is found
-
optimize
public static void optimize(ExpressionVisitor visitor, WithParam[] params, ContextItemStaticInfo contextItemType) throws XPathException
Static method to optimize a set of with-param elements- Parameters:
params- the set of parameters to be optimizedvisitor- the expression visitorcontextItemType- static information about the context item type and existence- Throws:
XPathException- if a static error is found
-
getEvaluationMode
public EvaluationMode getEvaluationMode()
Get the evaluation mode of the variable- Returns:
- the evaluation mode (a constant in
EvaluationMode
-
copy
public static WithParam[] copy(Expression parent, WithParam[] params, RebindingMap rebindings)
Static method to copy a set of parameters- Parameters:
parent- the new parent expressionparams- the parameters to be copied- Returns:
- the resulting copy
-
gatherOperands
public static void gatherOperands(Expression parent, WithParam[] params, java.util.List<Operand> list)
Static method to gather the XPath expressions used in an array of WithParam parameters (add them to the supplied list)- Parameters:
parent- the containing expressionparams- the set of with-param elements to be searchedlist- the list to which the subexpressions will be added
-
exportParameters
public static void exportParameters(WithParam[] params, ExpressionPresenter out, boolean tunnel) throws XPathException
Static method to export a set of parameters- Parameters:
params- the set of parameters to be exportedout- the destination for the outputtunnel- true if these are tunnel parameters- Throws:
XPathException
-
getSelectValue
public Sequence getSelectValue(XPathContext context) throws XPathException
Evaluate the variable. That is, get the value of the select expression if present or the content of the element otherwise, either as a tree or as a sequence- Parameters:
context- the XPath dynamic context- Returns:
- the result of evaluating the variable
- Throws:
XPathException- if evaluation of the select expression fails with a dynamic error
-
isTypeChecked
public boolean isTypeChecked()
Ask whether static type checking has been done- Returns:
- true if the caller has done static type checking against the type required by the callee
-
-