Class RuleManager

  • public final class RuleManager
    extends java.lang.Object
    RuleManager maintains a set of template rules, one set for each mode
    • Method Detail

      • setUnnamedModeExplicit

        public void setUnnamedModeExplicit​(boolean declared)
        Say that the unnamed mode has been explicitly declared in an xsl:mode declaration
        declared - true if it has been explicitly declared
      • isUnnamedModeExplicit

        public boolean isUnnamedModeExplicit()
        Ask whether the unnamed mode has been explicitly declared in an xsl:mode declaration
        true if it has been explicitly declared
      • setCompilerInfo

        public void setCompilerInfo​(CompilerInfo compilerInfo)
        Set the compiler information specifically.
        compilerInfo - the compiler options in use
      • getStylesheetPackage

        public StylesheetPackage getStylesheetPackage()
        Get the stylesheet package
        the stylesheet package
      • getAllNamedModes

        public java.util.Collection<Mode> getAllNamedModes()
        Get all registered modes
        a collection containing all registered modes excluding the unnamed mode
      • getUnnamedMode

        public SimpleMode getUnnamedMode()
        Get the mode object for the unnamed mode
        the unnamed mode
      • obtainMode

        public Mode obtainMode​(StructuredQName modeName,
                               boolean createIfAbsent)
        Get the Mode object for a named mode. If there is not one already registered. a new Mode is created. This uses a makeMode() method in the configuration
        modeName - The name of the mode. Supply null to get the default mode or Mode.ALL_MODES to get the Mode object containing "mode=all" rules
        createIfAbsent - if true, then if the mode does not already exist it will be created. If false, then if the mode does not already exist the method returns null. But if the requested mode is the omnimode, it is considered to always exist, and is therefore created regardless.
        the Mode with this name
      • registerMode

        public void registerMode​(Mode mode)
      • allocateSequenceNumber

        public int allocateSequenceNumber()
      • registerRule

        public int registerRule​(Pattern pattern,
                                TemplateRule eh,
                                Mode mode,
                                StylesheetModule module,
                                double priority,
                                int position,
                                int part)
        Register a template for a particular pattern.
        pattern - Must be a valid Pattern.
        eh - The Template to be used
        mode - The processing mode to which this template applies
        module - The stylesheet module containing the template rule
        priority - The priority of the rule: if an element matches several patterns, the one with highest priority is used. The value is NaN if no explicit priority was specified
        position - The relative position of the rule in declaration order
        part - Zero for a "real" rule; an incremented integer for rules generated by splitting a real rule on a union pattern, in cases where no user-specified priority is supplied.
        the number of (sub-)rules registered
        See Also:
      • computeRankings

        public void computeRankings()
                             throws XPathException
        Allocate rankings to the rules within each mode. This method must be called when all the rules in each mode are known. This method also checks that there are no conflicts for property values in different xsl:mode declarations
        XPathException - if an error occurs
      • invertStreamableTemplates

        public void invertStreamableTemplates()
                                       throws XPathException
        Invert streamable templates in all streamable modes
        XPathException - if the templates are not streamable
      • checkConsistency

        public void checkConsistency()
                              throws XPathException
        Check all modes for conflicts in property values
        XPathException - if a mode has conflicting property values
      • explainTemplateRules

        public void explainTemplateRules​(ExpressionPresenter presenter)
                                  throws XPathException
        Explain (that is, output the expression tree) for all template rules
        presenter - the object used to present the output
      • optimizeRules

        public void optimizeRules()
        Optimization of template rules Only invoked when rule optimization has been turned on. In this case we know the modes are instances of at least ModeEE