Package net.sf.saxon.style
Class SourceBinding
- java.lang.Object
-
- net.sf.saxon.style.SourceBinding
-
public class SourceBinding extends java.lang.Object
Helper class for xsl:variable and xsl:param elements.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SourceBinding.BindingProperty
-
Field Summary
Fields Modifier and Type Field Description protected SlotManager
slotManager
-
Constructor Summary
Constructors Constructor Description SourceBinding(StyleElement sourceElement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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 typeGroundedValue
getConstantValue()
SequenceType
getDeclaredType()
Get the type actually declared for the attributeSequenceType
getInferredType(boolean useContentRules)
Get the best available static type of the variable.java.util.List<BindingReference>
getReferences()
Get all the known references to this variableExpression
getSelectExpression()
Get the select expression actually appearing in the variable declarationSlotManager
getSlotManager()
Get the SlotManager associated with this stylesheet construct.StyleElement
getSourceElement()
Get the declaration in the stylesheetStructuredQName
getVariableQName()
Get 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
hasProperty(SourceBinding.BindingProperty prop)
Get a boolean property of the variableboolean
isStatic()
void
postValidate()
Hook to allow additional validation of a parent element immediately after its children have been validated.void
prepareAttributes(java.util.EnumSet<SourceBinding.BindingProperty> permittedAttributes)
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.void
registerReference(BindingReference ref)
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
setVariableQName(StructuredQName name)
Set the name of the variablevoid
validate()
Validate the declaration
-
-
-
Field Detail
-
slotManager
protected SlotManager slotManager
-
-
Constructor Detail
-
SourceBinding
public SourceBinding(StyleElement sourceElement)
-
-
Method Detail
-
prepareAttributes
public void prepareAttributes(java.util.EnumSet<SourceBinding.BindingProperty> permittedAttributes)
-
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
public StyleElement getSourceElement()
Get the declaration in the stylesheet- Returns:
- the node in the stylesheet containing this variable binding
-
setVariableQName
public void setVariableQName(StructuredQName name)
Set the name of the variable- Parameters:
name
- the name of the variable as a QName
-
setDeclaredType
public void setDeclaredType(SequenceType declaredType)
Set the declared type of the variable- Parameters:
declaredType
- the declared type
-
validate
public void validate() throws XPathException
Validate the declaration- Throws:
XPathException
- if the declaration is invalid
-
postValidate
public void postValidate() throws XPathException
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
public void checkAgainstRequiredType(SequenceType required)
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
public StructuredQName getVariableQName()
Get the name of the variable- Returns:
- the variable's name
-
setProperty
public void setProperty(SourceBinding.BindingProperty prop, boolean flag)
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
public boolean hasProperty(SourceBinding.BindingProperty prop)
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
public java.util.List<BindingReference> getReferences()
Get all the known references to this variable- Returns:
- the list of references
-
getSlotManager
public SlotManager 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
public SequenceType 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
public Expression 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
public SequenceType getInferredType(boolean useContentRules)
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
public void registerReference(BindingReference ref)
Method called by VariableReference to register the variable reference for subsequent fixup- Parameters:
ref
- the variable reference being registered
-
getConstantValue
public GroundedValue getConstantValue()
-
fixupReferences
public void fixupReferences(GlobalVariable compiledGlobalVariable)
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
protected void fixupBinding(Binding binding)
Notify all variable references of the Binding instruction- Parameters:
binding
- the Binding that represents this variable declaration in the executable code tree
-
-