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:
javax.xml.transform.SourceLocator
,Binding
public class WithParam extends GeneralVariable
An object derived from a xsl:with-param element in the stylesheet.
-
-
Field Summary
Fields Modifier and Type Field Description static WithParam[]
EMPTY_ARRAY
(package private) int
parameterId
(package private) boolean
typeChecked
-
Fields inherited from class net.sf.saxon.expr.instruct.GeneralVariable
evaluationMode, referenceCount, requiredType, select, slotNumber, variableQName
-
-
Constructor Summary
Constructors Constructor Description WithParam()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static WithParam[]
copy(WithParam[] params)
Static method to copy a set of parametersValueRepresentation
evaluateVariable(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, java.util.List<Expression> list)
Static method to gather the XPath expressions used in an array of WithParam parameters (add them to the supplied list)int
getInstructionNameCode()
Get the name of this instruction (that is xsl:variable, xsl:param etc) for diagnosticsint
getParameterId()
Get the parameter id, which is essentially an alias for the parameter name, unique within a stylesheetboolean
isTypeChecked()
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 elements-
Methods 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 Detail
-
EMPTY_ARRAY
public static WithParam[] EMPTY_ARRAY
-
parameterId
int parameterId
-
typeChecked
boolean typeChecked
-
-
Method Detail
-
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
public static void simplify(WithParam[] params, ExpressionVisitor visitor) throws XPathException
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:
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
-
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
public static WithParam[] copy(WithParam[] params)
Static method to copy a set of parameters- Parameters:
params
- the parameters to be copied- Returns:
- the resulting copy
-
gatherXPathExpressions
public static void gatherXPathExpressions(WithParam[] params, java.util.List<Expression> list)
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
public static void explainParameters(WithParam[] params, ExpressionPresenter out)
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
public ValueRepresentation evaluateVariable(XPathContext context) throws XPathException
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
-
-