Package net.sf.saxon.trans.rules
Class RuleManager
java.lang.Object
net.sf.saxon.trans.rules.RuleManager
RuleManager maintains a set of template rules, one set for each mode
-
Constructor Summary
ConstructorsConstructorDescriptionRuleManager
(StylesheetPackage pack) create a RuleManager and initialise variables.RuleManager
(StylesheetPackage pack, CompilerInfo compilerInfo) -
Method Summary
Modifier and TypeMethodDescriptionint
void
Check all modes for conflicts in property valuesvoid
Allocate rankings to the rules within each mode.void
explainTemplateRules
(ExpressionPresenter presenter) Explain (that is, output the expression tree) for all template rulesGet all registered modesGet the stylesheet packageGet the mode object for the unnamed modevoid
Invert streamable templates in all streamable modesboolean
Ask whether the unnamed mode has been explicitly declared in an xsl:mode declarationobtainMode
(StructuredQName modeName, boolean createIfAbsent) Get the Mode object for a named mode.void
Optimization of template rules Only invoked when rule optimization has been turned on.void
registerMode
(Mode mode) int
registerRule
(Pattern pattern, TemplateRule eh, Mode mode, StylesheetModule module, double priority, int position, int part) Register a template for a particular pattern.void
setCompilerInfo
(CompilerInfo compilerInfo) Set the compiler information specifically.void
setUnnamedModeExplicit
(boolean declared) Say that the unnamed mode has been explicitly declared in an xsl:mode declaration
-
Constructor Details
-
RuleManager
create a RuleManager and initialise variables. -
RuleManager
-
-
Method Details
-
setUnnamedModeExplicit
public void setUnnamedModeExplicit(boolean declared) Say that the unnamed mode has been explicitly declared in an xsl:mode declaration- Parameters:
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- Returns:
- true if it has been explicitly declared
-
setCompilerInfo
Set the compiler information specifically.- Parameters:
compilerInfo
- the compiler options in use
-
getStylesheetPackage
Get the stylesheet package- Returns:
- the stylesheet package
-
getAllNamedModes
Get all registered modes- Returns:
- a collection containing all registered modes excluding the unnamed mode
-
getUnnamedMode
Get the mode object for the unnamed mode- Returns:
- the unnamed mode
-
obtainMode
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- Parameters:
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" rulescreateIfAbsent
- 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.- Returns:
- the Mode with this name
-
registerMode
-
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.- Parameters:
pattern
- Must be a valid Pattern.eh
- The Template to be usedmode
- The processing mode to which this template appliesmodule
- The stylesheet module containing the template rulepriority
- 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 specifiedposition
- The relative position of the rule in declaration orderpart
- 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.- Returns:
- the number of (sub-)rules registered
- See Also:
-
computeRankings
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- Throws:
XPathException
- if an error occurs
-
invertStreamableTemplates
Invert streamable templates in all streamable modes- Throws:
XPathException
- if the templates are not streamable
-
checkConsistency
Check all modes for conflicts in property values- Throws:
XPathException
- if a mode has conflicting property values
-
explainTemplateRules
Explain (that is, output the expression tree) for all template rules- Parameters:
presenter
- the object used to present the output- Throws:
XPathException
-
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
-