Package net.sf.saxon.style
Class SourceBinding
java.lang.Object
net.sf.saxon.style.SourceBinding
Helper class for xsl:variable and xsl:param elements.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkAgainstRequiredType
(SequenceType required) Check the supplied select expression against the required type.protected void
fixupBinding
(Binding binding) Notify all variable references of the Binding instructionvoid
fixupReferences
(GlobalVariable compiledGlobalVariable) Notify all references to this variable of the data typeGet the type actually declared for the attributegetInferredType
(boolean useContentRules) Get the best available static type of the variable.Get all the known references to this variableGet the select expression actually appearing in the variable declarationGet the SlotManager associated with this stylesheet construct.Get the declaration in the stylesheetGet the name of the variablevoid
handleSequenceConstructor
(Compilation compilation, ComponentDeclaration decl) If the element contains a sequence constructor, convert this to an expression and assign it to the select attributeboolean
Get a boolean property of the variableboolean
isStatic()
void
Hook to allow additional validation of a parent element immediately after its children have been validated.void
prepareAttributes
(EnumSet<SourceBinding.BindingProperty> permittedAttributes) void
This method is called to establish basic signature information for local parameters of a named template, so that this can be checked against xsl:call-template instructions.void
Method called by VariableReference to register the variable reference for subsequent fixupvoid
setDeclaredType
(SequenceType declaredType) Set the declared type of the variablevoid
setProperty
(SourceBinding.BindingProperty prop, boolean flag) Set a boolean property of the variablevoid
Set the name of the variablevoid
validate()
Validate the declaration
-
Field Details
-
slotManager
-
-
Constructor Details
-
SourceBinding
-
-
Method Details
-
prepareAttributes
-
prepareTemplateSignatureAttributes
public void prepareTemplateSignatureAttributes()This method is called to establish basic signature information for local parameters of a named template, so that this can be checked against xsl:call-template instructions. It is called while a named template is being indexed: see bug 3722. -
getSourceElement
Get the declaration in the stylesheet- Returns:
- the node in the stylesheet containing this variable binding
-
setVariableQName
Set the name of the variable- Parameters:
name
- the name of the variable as a QName
-
setDeclaredType
Set the declared type of the variable- Parameters:
declaredType
- the declared type
-
validate
Validate the declaration- Throws:
XPathException
- if the declaration is invalid
-
postValidate
Hook to allow additional validation of a parent element immediately after its children have been validated.- Throws:
XPathException
- if the declaration is invalid
-
isStatic
public boolean isStatic() -
checkAgainstRequiredType
Check the supplied select expression against the required type.- Parameters:
required
- The type required by the variable declaration, or in the case of xsl:with-param, the signature of the called template
-
getVariableQName
Get the name of the variable- Returns:
- the variable's name
-
setProperty
Set a boolean property of the variable- Parameters:
prop
- the property to be set (e.g.SourceBinding.BindingProperty.TUNNEL
)flag
- true to set the property on, false to set it off
-
hasProperty
Get a boolean property of the variable- Parameters:
prop
- the property whose value is required- Returns:
- true if the variable has the specified property, otherwise false
-
getReferences
Get all the known references to this variable- Returns:
- the list of references
-
getSlotManager
Get the SlotManager associated with this stylesheet construct. The SlotManager contains the information needed to manage the local stack frames used by run-time instances of the code.- Returns:
- the associated SlotManager object
-
handleSequenceConstructor
public void handleSequenceConstructor(Compilation compilation, ComponentDeclaration decl) throws XPathException If the element contains a sequence constructor, convert this to an expression and assign it to the select attribute- Parameters:
compilation
- the compilation episodedecl
- the declaration being compiled- Throws:
XPathException
- if a static error is found, for example a type error
-
getDeclaredType
Get the type actually declared for the attribute- Returns:
- the type appearing in the "as" attribute, or null if the attribute was absent
-
getSelectExpression
Get the select expression actually appearing in the variable declaration- Returns:
- the select expression as it appears, or null if it is absent
-
getInferredType
Get the best available static type of the variable.- Parameters:
useContentRules
- set to true if the standard rules for xsl:variable and similar elements apply, whereby the element's contained sequence constructor substitutes for the select attribute- Returns:
- the static type declared for the variable, or inferred from its initialization
-
registerReference
Method called by VariableReference to register the variable reference for subsequent fixup- Parameters:
ref
- the variable reference being registered
-
getConstantValue
-
fixupReferences
Notify all references to this variable of the data type- Parameters:
compiledGlobalVariable
- null if this is a local variable; otherwise, the compiled global variable
-
fixupBinding
Notify all variable references of the Binding instruction- Parameters:
binding
- the Binding that represents this variable declaration in the executable code tree
-