Class SourceBinding


  • public class SourceBinding
    extends java.lang.Object
    Helper class for xsl:variable and xsl:param elements.
    • Constructor Detail

      • SourceBinding

        public SourceBinding​(StyleElement sourceElement)
    • Method Detail

      • 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
      • 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
      • 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 episode
        decl - 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
      • 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