Package net.sf.saxon.expr.instruct
Class WithParam
java.lang.Object
net.sf.saxon.expr.instruct.GeneralVariable
net.sf.saxon.expr.instruct.WithParam
- All Implemented Interfaces:
SourceLocator
,Binding
An object derived from a xsl:with-param element in the stylesheet.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic WithParam[]
(package private) int
(package private) boolean
Fields inherited from class net.sf.saxon.expr.instruct.GeneralVariable
evaluationMode, referenceCount, requiredType, select, slotNumber, variableQName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic WithParam[]
Static method to copy a set of parametersevaluateVariable
(XPathContext context) Evaluate the variable (method exists only to satisfy the interface)static void
explainParameters
(WithParam[] params, ExpressionPresenter out) Static method to explain a set of parametersstatic void
gatherXPathExpressions
(WithParam[] params, List<Expression> list) Static method to gather the XPath expressions used in an array of WithParam parameters (add them to the supplied list)int
Get the name of this instruction (that is xsl:variable, xsl:param etc) for diagnosticsint
Get the parameter id, which is essentially an alias for the parameter name, unique within a stylesheetboolean
Ask whether static type checking has been donestatic void
optimize
(ExpressionVisitor visitor, WithParam[] params, ExpressionVisitor.ContextItemType contextItemType) Static method to optimize a set of with-param elementsstatic void
promoteParams
(Expression parent, WithParam[] params, PromotionOffer offer) Static method to do expression promotion on a set of with-param elementsstatic boolean
replaceXPathExpression
(WithParam[] params, Expression original, Expression replacement) Static method to replace a subexpression within any parameter within which it is foundvoid
setParameterId
(int id) Allocate a number which is essentially an alias for the parameter name, unique within a stylesheetvoid
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 checkstatic void
simplify
(WithParam[] params, ExpressionVisitor visitor) Static method to simplify a set of with-param elementsstatic void
typeCheck
(WithParam[] params, ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) Static method to typecheck a set of with-param elementsMethods inherited from class net.sf.saxon.expr.instruct.GeneralVariable
addReference, checkAgainstRequiredType, computeEvaluationMode, copy, explain, getCardinality, getColumnNumber, getContainer, getEvaluationMode, getExecutable, getIntegerBoundsForVariable, getLineNumber, getLocalSlotNumber, getLocationId, getLocationProvider, getPublicId, getRequiredType, getSelectExpression, getSelectValue, getSlotNumber, getSystemId, getSystemId, getVariableQName, init, isAssignable, isGlobal, isImplicitlyRequiredParam, isRequiredParam, isTunnelParam, iterateSubExpressions, optimize, replaceSubExpression, setAssignable, setContainer, setImplicitlyRequiredParam, setLocationId, setReferenceCount, setRequiredParam, setRequiredType, setSelectExpression, setSlotNumber, setTunnel, setVariableQName, simplify, typeCheck
-
Field Details
-
EMPTY_ARRAY
-
parameterId
int parameterId -
typeChecked
boolean typeChecked
-
-
Constructor Details
-
WithParam
public WithParam()
-
-
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
-
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
-
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
-
getInstructionNameCode
public int getInstructionNameCode()Description copied from class:GeneralVariable
Get the name of this instruction (that is xsl:variable, xsl:param etc) for diagnostics- Overrides:
getInstructionNameCode
in classGeneralVariable
- Returns:
- the name of this instruction, as a name pool name code
-
simplify
Static method to simplify a set of with-param elements- Parameters:
params
- the set of parameters to be simplifiedvisitor
- the expression visitor- Throws:
XPathException
- if a static error is found
-
typeCheck
public static void typeCheck(WithParam[] params, ExpressionVisitor visitor, ExpressionVisitor.ContextItemType 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, ExpressionVisitor.ContextItemType contextItemType) throws XPathException Static method to optimize a set of with-param elements- Parameters:
visitor
- the expression visitorparams
- the set of parameters to be optimizedcontextItemType
- static information about the context item type and existence- Throws:
XPathException
- if a static error is found
-
promoteParams
public static void promoteParams(Expression parent, WithParam[] params, PromotionOffer offer) throws XPathException Static method to do expression promotion on a set of with-param elements- Parameters:
parent
- the parent instruction (for example apply-templates or call-template)params
- the set of parameters to be be investigated for promotionoffer
- the promotion offer to be passed to subexpressions- Throws:
XPathException
- if a static error is found
-
copy
Static method to copy a set of parameters- Parameters:
params
- the parameters to be copied- Returns:
- the resulting copy
-
gatherXPathExpressions
Static method to gather the XPath expressions used in an array of WithParam parameters (add them to the supplied list)- Parameters:
params
- the set of with-param elements to be searchedlist
- the list to which the subexpressions will be added
-
explainParameters
Static method to explain a set of parameters- Parameters:
params
- the set of parameters to be explainedout
- the destination for the explanation
-
replaceXPathExpression
public static boolean replaceXPathExpression(WithParam[] params, Expression original, Expression replacement) Static method to replace a subexpression within any parameter within which it is found- Parameters:
params
- the set of parameters to be examinedoriginal
- the subexpression to be replacedreplacement
- the replacement expression- Returns:
- true if a replacement was made
-
evaluateVariable
Evaluate the variable (method exists only to satisfy the interface)- Parameters:
context
- the XPath dynamic evaluation context- Returns:
- the result of evaluating the variable
- Throws:
XPathException
- if an error occurs while evaluating the variable
-
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
-