Class XSLVariableDeclaration

All Implemented Interfaces:
Serializable, Source, SourceLocator, LocationProvider, SaxonLocator, PullEvent, Container, VariableDeclaration, FingerprintedNode, Item<NodeInfo>, MutableNodeInfo, NamespaceResolver, NodeInfo, ValueRepresentation<NodeInfo>, StylesheetProcedure, InstructionInfo, SiblingCountingNode, Locator
Direct Known Subclasses:
XSLParam, XSLVariable

public abstract class XSLVariableDeclaration extends XSLGeneralVariable implements VariableDeclaration, StylesheetProcedure
Generic class for xsl:variable and xsl:param elements.
See Also:
  • Field Details

    • references

      protected List references
  • Constructor Details

    • XSLVariableDeclaration

      public XSLVariableDeclaration()
  • Method Details

    • isDeclaration

      public boolean isDeclaration()
      Ask whether this node is a declaration, that is, a permitted child of xsl:stylesheet (including xsl:include and xsl:import).
      Overrides:
      isDeclaration in class StyleElement
      Returns:
      true for this element
    • 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.
      Specified by:
      getSlotManager in interface StylesheetProcedure
      Returns:
      the associated SlotManager object
    • getSlotNumber

      public int getSlotNumber()
      Get the slot number allocated to this variable (its position in the stackframe)
      Returns:
      the allocated slot number
    • setSlotNumber

      public void setSlotNumber(int slot)
      Allocate a slot number to this variable
      Parameters:
      slot - the position of the variable on the local stack frame
    • getRequiredType

      public abstract SequenceType getRequiredType()
      Get the static type of the variable.
      Returns:
      the static type declared for the variable
    • registerReference

      public void registerReference(BindingReference ref)
      Method called by VariableReference to register the variable reference for subsequent fixup
      Specified by:
      registerReference in interface VariableDeclaration
      Parameters:
      ref - the variable reference
    • isInstruction

      public boolean isInstruction()
      Determine whether this node is an instruction.
      Overrides:
      isInstruction in class StyleElement
      Returns:
      true - it is an instruction (well, it can be, anyway)
    • fixupReferences

      public void fixupReferences() throws XPathException
      Notify all references to this variable of the data type
      Overrides:
      fixupReferences in class StyleElement
      Throws:
      XPathException - if any references cannot be fixed up.
    • validate

      public void validate(Declaration decl) throws XPathException
      Check that the variable is not already declared, and allocate a slot number
      Overrides:
      validate in class XSLGeneralVariable
      Parameters:
      decl -
      Throws:
      XPathException - if any error is found during validation
    • 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.
      Overrides:
      setReferenceCount in class XSLGeneralVariable
      Parameters:
      var - the variable
    • index

      protected void index(Declaration decl, PrincipalStylesheetModule top) throws XPathException
      Description copied from class: StyleElement
      Method supplied by declaration elements to add themselves to a stylesheet-level index
      Overrides:
      index in class StyleElement
      Parameters:
      decl - the Declaration being indexed. (This corresponds to the StyleElement object except in cases where one module is imported several times with different precedence.)
      top - the outermost XSLStylesheet element
      Throws:
      XPathException - if any error is encountered
    • optimize

      public void optimize(Declaration declaration) throws XPathException
      Optimize the stylesheet construct
      Specified by:
      optimize in interface StylesheetProcedure
      Parameters:
      declaration -
      Throws:
      XPathException
    • getCompiledVariable

      public GeneralVariable getCompiledVariable()
      Get the compiled variable
      Returns:
      the compiled variable if it has been compiled, or null otherwise