net.sf.saxon.style

## Class SourceBinding

- java.lang.Object
- - net.sf.saxon.style.SourceBinding

-     public class SourceBinding
      extends Object

  Helper class for xsl:variable and xsl:param elements.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `AS`
    `static int` | `ASSIGNABLE`
    `protected GeneralVariable` | `compiledVariable`
    `protected String` | `constantText`
    `static int` | `DISALLOWS_CONTENT`
    `static int` | `GLOBAL`
    `static int` | `GROUP`
    `static int` | `IMPLICITLY_REQUIRED`
    `static int` | `PARAM`
    `static int` | `PRIVATE`
    `static int` | `REQUIRED`
    `static int` | `SELECT`
    `protected SlotManager` | `slotManager`
    `static int` | `STATIC`
    `static int` | `TUNNEL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SourceBinding(StyleElement sourceElement)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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 instruction
    `void` | `fixupReferences()` Notify all references to this variable of the data type
    `GeneralVariable` | `getCompiledVariable()` Get the compiled variable
    `SequenceType` | `getDeclaredType()` Get the type actually declared for the attribute
    `SequenceType` | `getInferredType(boolean useContentRules)` Get the best available static type of the variable.
    `List<BindingReference>` | `getReferences()` Get all the known references to this variable
    `Expression` | `getSelectExpression()` Get the select expression actually appearing in the variable declaration
    `SlotManager` | `getSlotManager()` Get the SlotManager associated with this stylesheet construct.
    `StyleElement` | `getSourceElement()` Get the declaration in the stylesheet
    `StructuredQName` | `getVariableQName()` Get the name of the variable
    `void` | `handleSequenceConstructor(Executable exec, Declaration decl)` If the element contains a sequence constructor, convert this to an expression and assign it to the select attribute
    `boolean` | `hasProperty(int prop)` Get a boolean property of the variable
    `boolean` | `isStatic()`
    `void` | `postValidate()` Hook to allow additional validation of a parent element immediately after its children have been validated.
    `void` | `prepareAttributes(int permittedAttributes)`
    `void` | `registerReference(BindingReference ref)` Method called by VariableReference to register the variable reference for subsequent fixup
    `void` | `setProperty(int prop, boolean flag)` Set a boolean property of the variable
    `protected void` | `setReferenceCount(GeneralVariable var)` Set the number of references to this variable.
    `void` | `setVariableQName(StructuredQName name)` Set the name of the variable
    `void` | `validate()` Validate the declartaion

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### constantText

          protected String constantText

    - #### slotManager

          protected SlotManager slotManager

    - #### compiledVariable

          protected GeneralVariable compiledVariable

    - #### PRIVATE

          public static final int PRIVATE

      See Also:
        Constant Field Values

    - #### GLOBAL

          public static final int GLOBAL

      See Also:
        Constant Field Values

    - #### PARAM

          public static final int PARAM

      See Also:
        Constant Field Values

    - #### TUNNEL

          public static final int TUNNEL

      See Also:
        Constant Field Values

    - #### REQUIRED

          public static final int REQUIRED

      See Also:
        Constant Field Values

    - #### IMPLICITLY_REQUIRED

          public static final int IMPLICITLY_REQUIRED

      See Also:
        Constant Field Values

    - #### ASSIGNABLE

          public static final int ASSIGNABLE

      See Also:
        Constant Field Values

    - #### SELECT

          public static final int SELECT

      See Also:
        Constant Field Values

    - #### AS

          public static final int AS

      See Also:
        Constant Field Values

    - #### DISALLOWS_CONTENT

          public static final int DISALLOWS_CONTENT

      See Also:
        Constant Field Values

    - #### GROUP

          public static final int GROUP

      See Also:
        Constant Field Values

    - #### STATIC

          public static final int STATIC

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SourceBinding

          public SourceBinding(StyleElement sourceElement)

  - ### Method Detail

    - #### prepareAttributes

          public void prepareAttributes(int permittedAttributes)
                                 throws XPathException

      Throws:
        `XPathException`

    - #### 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

    - #### validate

          public void validate()
                        throws XPathException

      Validate the declartaion
      Throws:
        `XPathException`

    - #### postValidate

          public void postValidate()
                            throws XPathException

      Hook to allow additional validation of a parent element immediately after its children have been validated.
      Throws:
        `XPathException`

    - #### isStatic

          public boolean isStatic()

    - #### checkAgainstRequiredType

          public void checkAgainstRequiredType(SequenceType required)
                                        throws XPathException

      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
      Throws:
        `XPathException` - if an error is detected

    - #### getVariableQName

          public StructuredQName getVariableQName()

      Get the name of the variable
      Returns:
        the variable's name

    - #### setProperty

          public void setProperty(int prop,
                         boolean flag)

      Set a boolean property of the variable
      Parameters:
        `prop` - the property to be set (e.g. `TUNNEL`)
        `flag` - true to set the property on, false to set it off

    - #### hasProperty

          public boolean hasProperty(int 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 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(Executable exec,
                                       Declaration decl)
                                         throws XPathException

      If the element contains a sequence constructor, convert this to an expression and assign it to the select attribute
      Parameters:
        `exec` - the executable
        `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()
                               throws XPathException

      Notify all references to this variable of the data type
      Throws:
        `XPathException`

    - #### 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

    - #### setReferenceCount

          protected void setReferenceCount(GeneralVariable var)

      Set the number of references to this variable. This code is invoked only for a global variable, and only if there is at least one reference.
      Parameters:
        `var` - the variable

    - #### getCompiledVariable

          public GeneralVariable getCompiledVariable()

      Get the compiled variable
      Returns:
        the compiled variable if it has been compiled, or null otherwise

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.