public final class RuleManager
extends java.lang.Object
Constructor and Description |
---|
RuleManager(StylesheetPackage pack)
create a RuleManager and initialise variables.
|
RuleManager(StylesheetPackage pack,
CompilerInfo compilerInfo) |
Modifier and Type | Method and Description |
---|---|
int |
allocateSequenceNumber() |
void |
checkConsistency()
Check all modes for conflicts in property values
|
void |
computeRankings()
Allocate rankings to the rules within each mode.
|
boolean |
existsOmniMode() |
void |
explainTemplateRules(ExpressionPresenter presenter)
Explain (that is, output the expression tree) for all template rules
|
java.util.Collection<Mode> |
getAllNamedModes()
Get all registered modes
|
int |
getRecoveryPolicy()
Get the policy for handling recoverable errors.
|
Rule |
getTemplateRule(Item item,
Mode mode,
int min,
int max,
XPathContext c)
Get the template rule matching a given item whose import precedence
is in a particular range.
|
SimpleMode |
getUnnamedMode()
Get the mode object for the unnamed mode
|
void |
invertStreamableTemplates()
Invert streamable templates in all streamable modes
|
boolean |
isUnnamedModeExplicit()
Ask whether the unnamed mode has been explicitly declared in an xsl:mode declaration
|
Mode |
obtainMode(StructuredQName modeName,
boolean createIfAbsent)
Get the Mode object for a named mode.
|
void |
optimizeRules()
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 |
setRecoveryPolicy(int policy)
Set the policy for handling recoverable errors.
|
void |
setUnnamedModeExplicit(boolean declared)
Say that the unnamed mode has been explicitly declared in an xsl:mode declaration
|
public RuleManager(StylesheetPackage pack)
public RuleManager(StylesheetPackage pack, CompilerInfo compilerInfo)
public void setUnnamedModeExplicit(boolean declared)
declared
- true if it has been explicitly declaredpublic boolean isUnnamedModeExplicit()
public void setCompilerInfo(CompilerInfo compilerInfo)
compilerInfo
- the compiler options in usepublic void setRecoveryPolicy(int policy)
policy
- the recovery policy to be used. The options are Configuration.RECOVER_SILENTLY
,
Configuration.RECOVER_WITH_WARNINGS
, or Configuration.DO_NOT_RECOVER
.public int getRecoveryPolicy()
public java.util.Collection<Mode> getAllNamedModes()
public SimpleMode getUnnamedMode()
public Mode obtainMode(StructuredQName modeName, boolean createIfAbsent)
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.public void registerMode(Mode mode)
public boolean existsOmniMode()
public int allocateSequenceNumber()
public int registerRule(Pattern pattern, TemplateRule eh, Mode mode, StylesheetModule module, double priority, int position, int part)
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.Pattern
public Rule getTemplateRule(Item item, Mode mode, int min, int max, XPathContext c) throws XPathException
item
- The item to be matchedmode
- The mode for which a rule is requiredmin
- The minimum import precedence that the rule must havemax
- The maximum import precedence that the rule must havec
- The Controller for the transformationXPathException
- if an error occurs matching a patternpublic void computeRankings() throws XPathException
XPathException
- if an error occurspublic void invertStreamableTemplates() throws XPathException
XPathException
- if the templates are not streamablepublic void checkConsistency() throws XPathException
XPathException
- if a mode has conflicting property valuespublic void explainTemplateRules(ExpressionPresenter presenter) throws XPathException
presenter
- the object used to present the outputXPathException
public void optimizeRules()
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.