Class StyleElement

    • Field Detail

      • attributeSets

        protected java.util.Vector attributeSets
      • extensionNamespaces

        protected short[] extensionNamespaces
      • version

        protected java.lang.String version
      • validationError

        protected javax.xml.transform.TransformerConfigurationException validationError
      • reportingCircumstances

        protected int reportingCircumstances
      • REPORT_UNLESS_FORWARDS_COMPATIBLE

        public static final int REPORT_UNLESS_FORWARDS_COMPATIBLE
        See Also:
        Constant Field Values
    • Constructor Detail

      • StyleElement

        public StyleElement()
        Constructor
    • Method Detail

      • substituteFor

        public void substituteFor​(StyleElement temp)
        Make this node a substitute for a temporary one previously added to the tree. See StyleNodeFactory for details. "A node like the other one in all things but its class". Note that at this stage, the node will not yet be known to its parent, though it will contain a reference to its parent; and it will have no children.
      • setValidationError

        protected void setValidationError​(javax.xml.transform.TransformerException reason,
                                          int circumstances)
        Set a validation error
      • isInstruction

        public boolean isInstruction()
        Determine whether this node is an instruction. The default implementation says it isn't.
      • doesPostProcessing

        public boolean doesPostProcessing()
        Determine whether this element does any processing after instantiating any children. The default implementation says it does. Tail recursion only works if call-template is nested entirely in elements that do no such processing. (If the element is empty, this property is irrelevant, because the element cannot contain an xsl:call-template).
      • mayContainTemplateBody

        public boolean mayContainTemplateBody()
        Determine whether this type of element is allowed to contain a template-body
      • getContainingStyleSheet

        public XSLStyleSheet getContainingStyleSheet()
        Get the containing XSLStyleSheet element
      • getPrecedence

        public int getPrecedence()
        Get the import precedence of this stylesheet element.
      • getStandardNames

        public final StandardNames getStandardNames()
        Get the StandardNames object
      • processAllAttributes

        public void processAllAttributes()
                                  throws javax.xml.transform.TransformerConfigurationException
        Process the attributes of this element and all its children
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • processAttributes

        public final void processAttributes()
                                     throws javax.xml.transform.TransformerConfigurationException
        Process the attribute list for the element. This is a wrapper method that calls prepareAttributes (provided in the subclass) and traps any exceptions
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • checkUnknownAttribute

        protected void checkUnknownAttribute​(int nc)
                                      throws javax.xml.transform.TransformerConfigurationException
        Check whether an unknown attribute is permitted.
        Parameters:
        nc - The name code of the attribute name
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • prepareAttributes

        public abstract void prepareAttributes()
                                        throws javax.xml.transform.TransformerConfigurationException
        Set the attribute list for the element. This is called to process the attributes (note the distinction from processAttributes in the superclass). Must be supplied in a subclass
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • makeExpression

        public Expression makeExpression​(java.lang.String expression)
                                  throws javax.xml.transform.TransformerConfigurationException
        Make an expression in the context of this stylesheet element
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • makePattern

        public Pattern makePattern​(java.lang.String pattern)
                            throws javax.xml.transform.TransformerConfigurationException
        Make a pattern in the context of this stylesheet element
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • makeAttributeValueTemplate

        public Expression makeAttributeValueTemplate​(java.lang.String expression)
                                              throws javax.xml.transform.TransformerConfigurationException
        Make an attribute value template in the context of this stylesheet element
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • processExtensionElementAttribute

        protected void processExtensionElementAttribute​(int nc)
                                                 throws javax.xml.transform.TransformerConfigurationException
        Process the [xsl:]extension-element-prefixes attribute if there is one
        Parameters:
        nc - the name code of the attribute required
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • processExcludedNamespaces

        protected void processExcludedNamespaces​(int nc)
                                          throws javax.xml.transform.TransformerConfigurationException
        Process the [xsl:]exclude-result-prefixes attribute if there is one
        Parameters:
        nc - the name code of the attribute required
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • processVersionAttribute

        protected void processVersionAttribute​(int nc)
        Process the [xsl:]version attribute if there is one
        Parameters:
        nc - the name code of the attribute required
      • getVersion

        public java.lang.String getVersion()
        Get the version number on this element, or inherited from its ancestors
      • forwardsCompatibleModeIsEnabled

        public boolean forwardsCompatibleModeIsEnabled()
        Determine whether forwards-compatible mode is enabled for this element
      • definesExtensionElement

        protected boolean definesExtensionElement​(short uriCode)
        Check whether a particular extension element namespace is defined on this node. This checks this node only, not the ancestor nodes. The implementation checks whether the prefix is included in the [xsl:]extension-element-prefixes attribute.
        Parameters:
        uriCode - the namespace URI code being tested
      • isExtensionNamespace

        public boolean isExtensionNamespace​(short uriCode)
        Check whether a namespace uri defines an extension element. This checks whether the namespace is defined as an extension namespace on this or any ancestor node.
        Parameters:
        uriCode - the namespace URI code being tested
      • definesExcludedNamespace

        protected boolean definesExcludedNamespace​(short uriCode)
        Check whether this node excludes a particular namespace from the result. This method checks this node only, not the ancestor nodes.
        Parameters:
        uriCode - the code of the namespace URI being tested
      • isExcludedNamespace

        public boolean isExcludedNamespace​(short uriCode)
        Check whether a namespace uri defines an namespace excluded from the result. This checks whether the namespace is defined as an excluded namespace on this or any ancestor node.
        Parameters:
        uriCode - the code of the namespace URI being tested
      • validate

        public void validate()
                      throws javax.xml.transform.TransformerConfigurationException
        Check that the element is valid. This is called once for each element, after the entire tree has been built. As well as validation, it can perform first-time initialisation. The default implementation does nothing; it is normally overriden in subclasses.
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • preprocess

        public void preprocess()
                        throws javax.xml.transform.TransformerConfigurationException
        Default preprocessing method does nothing. It is implemented for those top-level elements that can be evaluated before the source document is available, for example xsl:key, xsl:attribute-set, xsl:template, xsl:locale
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • validateSubtree

        public void validateSubtree()
                             throws javax.xml.transform.TransformerConfigurationException
        Recursive walk through the stylesheet to validate all nodes
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • validateChildren

        protected void validateChildren()
                                 throws javax.xml.transform.TransformerConfigurationException
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • getPrincipalStyleSheet

        protected XSLStyleSheet getPrincipalStyleSheet()
        Get the principal XSLStyleSheet node. This gets the principal style sheet, i.e. the one originally loaded, that forms the root of the import/include tree
      • getPreparedStyleSheet

        public PreparedStyleSheet getPreparedStyleSheet()
        Get the PreparedStyleSheet object.
        Returns:
        the PreparedStyleSheet to which this stylesheet element belongs
      • checkWithinTemplate

        public void checkWithinTemplate()
                                 throws javax.xml.transform.TransformerConfigurationException
        Check that the stylesheet element is within a template body
        Throws:
        javax.xml.transform.TransformerConfigurationException - if not within a template body
      • checkTopLevel

        public void checkTopLevel()
                           throws javax.xml.transform.TransformerConfigurationException
        Convenience method to check that the stylesheet element is at the top level
        Throws:
        javax.xml.transform.TransformerConfigurationException - if not at top level
      • checkNotTopLevel

        public void checkNotTopLevel()
                              throws javax.xml.transform.TransformerConfigurationException
        Convenience method to check that the stylesheet element is not at the top level
        Throws:
        javax.xml.transform.TransformerConfigurationException - if it is at the top level
      • checkEmpty

        public void checkEmpty()
                        throws javax.xml.transform.TransformerConfigurationException
        Convenience method to check that the stylesheet element is empty
        Throws:
        javax.xml.transform.TransformerConfigurationException - if it is not empty
      • reportAbsence

        public void reportAbsence​(java.lang.String attribute)
                           throws javax.xml.transform.TransformerConfigurationException
        Convenience method to report the absence of a mandatory attribute
        Throws:
        javax.xml.transform.TransformerConfigurationException - if the attribute is missing
      • process

        public abstract void process​(Context context)
                              throws javax.xml.transform.TransformerException
        Process: called to do the real work of this stylesheet element. This method must be implemented in each subclass.
        Parameters:
        context - The context in the source XML document, giving access to the current node, the current variables, etc.
        Throws:
        javax.xml.transform.TransformerException
      • processChildren

        public void processChildren​(Context context)
                             throws javax.xml.transform.TransformerException
        Process the children of this node in the stylesheet
        Parameters:
        context - The context in the source XML document, giving access to the current node, the current variables, etc.
        Throws:
        javax.xml.transform.TransformerException
      • fallbackProcessing

        protected void fallbackProcessing​(StyleElement instruction,
                                          Context context)
                                   throws javax.xml.transform.TransformerException
        Perform fallback processing
        Throws:
        javax.xml.transform.TransformerException
      • handleSortKeys

        protected Expression handleSortKeys​(Expression select)
                                     throws javax.xml.transform.TransformerConfigurationException
        Modify the "select" expression to include any sort keys specified. Used in XSLForEach and XSLApplyTemplates
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • findAttributeSets

        protected void findAttributeSets​(java.lang.String use)
                                  throws javax.xml.transform.TransformerConfigurationException
        Determine the list of attribute-sets associated with this element. This is used for xsl:element, xsl:copy, xsl:attribute-set, and on literal result elements
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • processAttributeSets

        protected void processAttributeSets​(Context context)
                                     throws javax.xml.transform.TransformerException
        Expand the attribute sets referenced in this element's use-attribute-sets attribute
        Throws:
        javax.xml.transform.TransformerException
      • styleError

        protected javax.xml.transform.TransformerException styleError​(javax.xml.transform.TransformerException error)
        Construct an exception with diagnostic information
      • styleError

        protected javax.xml.transform.TransformerException styleError​(java.lang.String message)
      • compileError

        protected void compileError​(javax.xml.transform.TransformerException error)
                             throws javax.xml.transform.TransformerConfigurationException
        Construct an exception with diagnostic information
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • compileError

        protected void compileError​(java.lang.String message)
                             throws javax.xml.transform.TransformerConfigurationException
        Throws:
        javax.xml.transform.TransformerConfigurationException
      • isTopLevel

        public boolean isTopLevel()
        Test whether this is a top-level element
      • bindVariable

        public Binding bindVariable​(int fingerprint)
                             throws XPathException
        Bind a variable used in this element to the XSLVariable element in which it is declared
        Parameters:
        fingerprint - The fingerprint of the name of the variable
        Returns:
        a Binding for the variable
        Throws:
        XPathException - if the variable has not been declared
      • getVariableBinding

        public Binding getVariableBinding​(int fprint)
        Bind a variable used in this element to the XSLVariable element in which it is declared
        Parameters:
        fprint - The absolute name of the variable (as a namepool fingerprint)
        Returns:
        a Binding for the variable, or null if it has not been declared
      • getVariableNames

        public java.util.Enumeration[] getVariableNames()
        List the variables that are in scope for this stylesheet element. Designed for a debugger, not used by the processor.
        Returns:
        two Enumeration of Strings, the global ones [0] and the local ones [1]
      • getStyleSheetFunction

        public Function getStyleSheetFunction​(int fingerprint)
        Get a Function declared using a saxon:function element in the stylesheet
        Parameters:
        fingerprint - the fingerprint of the name of the function
        Returns:
        the Function object represented by this saxon:function; or null if not found