Package com.icl.saxon

Class RuleManager


  • public class RuleManager
    extends java.lang.Object
    RuleManager maintains a set of template rules, one set for each mode
    Version:
    10 December 1999: carved out of the old Controller class
    Author:
    Michael H. Kay
    • Constructor Detail

      • RuleManager

        public RuleManager​(NamePool pool)
        create a RuleManager and initialise variables
    • Method Detail

      • setStandaloneContext

        public void setStandaloneContext​(StandaloneContext context)
        Set the standalone context for XPath expressions and patterns. This is used only for expressions and patterns occurring outside the context of a stylesheet.
      • getStandaloneContext

        public StandaloneContext getStandaloneContext()
        Get the standalone context for XPath expressions and patterns. This is used only for expressions and patterns occurring outside the context of a stylesheet.
        Returns:
        the StandaloneContext associated with this RuleManager. Creates a new one if none has been set explicitly.
      • resetHandlers

        public void resetHandlers()
        Set up a new table of handlers.
      • getMode

        public Mode getMode​(int modeNameCode)
        Get the Mode object for a named mode. If there is not one already registered. a new Mode is created.
        Parameters:
        modeNameCode - The name code of the mode. Supply -1 to get the default mode.
      • setHandler

        public void setHandler​(java.lang.String pattern,
                               NodeHandler eh)
                        throws XPathException
        Register a handler for a particular pattern. This is a convenience interface that calls setHandler(pattern, eh, mode, precedence) with default mode and precedence.
        Parameters:
        pattern - A match pattern
        eh - The NodeHandler to be used
        Throws:
        XPathException
        See Also:
        NodeHandler, Pattern
      • setHandler

        public void setHandler​(Pattern pattern,
                               NodeHandler eh,
                               Mode mode,
                               int precedence)
        Register a handler for a particular pattern. The priority of the rule is the default priority for the pattern, which depends on the syntax of the pattern suppllied.
        Parameters:
        pattern - A match pattern
        eh - The ElementHandler to be used
        mode - The processing mode
        precedence - The import precedence (use 0 by default)
      • setHandler

        public void setHandler​(Pattern pattern,
                               NodeHandler eh,
                               Mode mode,
                               int precedence,
                               double priority)
        Register a handler for a particular pattern.
        Parameters:
        pattern - Must be a valid Pattern.
        eh - The ElementHandler to be used
        mode - The processing mode to which this element handler applies
        precedence - The import precedence of this rule
        priority - The priority of the rule: if an element matches several patterns, the one with highest priority is used
        See Also:
        NodeHandler, Pattern
      • getHandler

        public NodeHandler getHandler​(NodeInfo node,
                                      Context c)
                               throws javax.xml.transform.TransformerException
        Find the handler registered for a particular node in default mode.
        Parameters:
        node - The NodeInfo for the relevant node
        Returns:
        The handler that will process this node. Returns the default handler for the type of node if there is no specific one registered.
        Throws:
        javax.xml.transform.TransformerException
      • getHandler

        public NodeHandler getHandler​(NodeInfo node,
                                      Mode mode,
                                      Context c)
                               throws javax.xml.transform.TransformerException
        Find the handler registered for a particular node in a specific mode.
        Parameters:
        node - The NodeInfo for the relevant node
        mode - The processing mode
        Returns:
        The handler that will process this node Returns null if there is no specific handler registered.
        Throws:
        javax.xml.transform.TransformerException
      • getAllModes

        public java.util.Enumeration getAllModes()
        Get a list of all registered modes
        Returns:
        an Enumeration of all modes in use, excluding the default (unnamed) mode