Package net.sf.saxon.trans
Class CompoundMode
java.lang.Object
net.sf.saxon.expr.instruct.Actor
net.sf.saxon.trans.Mode
net.sf.saxon.trans.CompoundMode
- All Implemented Interfaces:
SourceLocator,ExpressionOwner,Location,Locator
A CompoundMode is a mode representing the templates contained within an xsl:override element in a using package
together with the rules in the corresponding mode of the base package.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.saxon.trans.Mode
Mode.RuleAction, Mode.RuleFilter -
Field Summary
Fields inherited from class net.sf.saxon.trans.Mode
DEFAULT_MODE_NAME, modeName, mustBeTyped, mustBeUntyped, OMNI_MODE_NAME, RECOVER_WITH_WARNINGS, UNNAMED_MODE_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAllocate slot numbers to all the external component references in this componentvoidcomputeRankings(int start) Compute a rank for each rule, as a combination of the precedence and priority, to allow rapid comparison.voidexplainTemplateRules(ExpressionPresenter presenter) Explain expression structure.voidexportTemplateRules(ExpressionPresenter presenter) Export expression structure.Get the active component of this mode.Get the built-in template rules to be used with this Mode in the case where there is no explicit template ruleGet the "explicit namespaces" matched by this mode.intGet the maximum precedence of the rules in this modeintGet the highest rank of the rules in this modegetRule(Item item, XPathContext context) Get the rule corresponding to a given item, by finding the best pattern match.getRule(Item item, XPathContext context, Predicate<Rule> filter) Get the rule corresponding to a given item, by finding the best Pattern match.intbooleanisEmpty()Ask whether there are any template rules in this mode (a mode could exist merely because it is referenced in apply-templates)voidprocessRules(Mode.RuleAction action) Walk over all the rules, applying a specified action to each one.Methods inherited from class net.sf.saxon.trans.Mode
applyTemplates, explain, export, exportUseAccumulators, getAccumulators, getBuiltInRuleSetForCode, getCodeForBuiltInRuleSet, getDeclaringComponent, getDefaultResultType, getModeName, getModeTitle, getNextMatchRule, getObjectName, getRecoveryPolicy, getRule, getSymbolicName, isDeclaredStreamable, isEnclosingMode, isModeTracing, isMustBeTyped, isUnnamedMode, makeNewContext, setAccumulators, setDefaultResultType, setEnclosingMode, setHasRules, setModeTracing, setRecoveryPolicy, setStreamableMethods inherited from class net.sf.saxon.expr.instruct.Actor
allocateBindingSlotsRecursive, getBody, getChildExpression, getColumnNumber, getComponentName, getDeclaredVisibility, getLineNumber, getLocation, getPackageData, getProperty, getPublicId, getRetainedStaticContext, getStackFrameMap, getSystemId, getTracingTag, isExportable, makeDeclaringComponent, obtainDeclaringComponent, process, saveLocation, setBody, setChildExpression, setColumnNumber, setDeclaredVisibility, setDeclaringComponent, setLineNumber, setPackageData, setRetainedStaticContext, setStackFrameMap, setSystemId
-
Constructor Details
-
CompoundMode
Create a compound Mode- Parameters:
base- the mode from the base (used) packageoverrides- the mode containing (only) the overriding template rules from the using package
-
-
Method Details
-
getBuiltInRuleSet
Get the built-in template rules to be used with this Mode in the case where there is no explicit template rule- Specified by:
getBuiltInRuleSetin classMode- Returns:
- the built-in rule set, defaulting to the TextOnlyCopyRuleSet if no other rule set has been supplied
-
getActivePart
Get the active component of this mode. For a simple mode this is the mode itself; for a compound mode it is the "overriding" part- Specified by:
getActivePartin classMode
-
isEmpty
public boolean isEmpty()Ask whether there are any template rules in this mode (a mode could exist merely because it is referenced in apply-templates) -
getMaxPrecedence
public int getMaxPrecedence()Get the maximum precedence of the rules in this mode- Specified by:
getMaxPrecedencein classMode
-
getMaxRank
public int getMaxRank()Get the highest rank of the rules in this mode- Specified by:
getMaxRankin classMode- Returns:
- the highest rank
-
computeRankings
Compute a rank for each rule, as a combination of the precedence and priority, to allow rapid comparison. This method also checks that there are no conflicts for property values in different xsl:mode declarations- Specified by:
computeRankingsin classMode- Parameters:
start- the lowest rank to use- Throws:
XPathException- if an error occurs processing the rules
-
processRules
Walk over all the rules, applying a specified action to each one.- Specified by:
processRulesin classMode- Parameters:
action- an action that is to be applied to all the rules in this Mode- Throws:
XPathException- if an error occurs processing any of the rules
-
getExplicitNamespaces
Get the "explicit namespaces" matched by this mode. Returns a set containing all the namespaces matched by specific template rules in this mode- Specified by:
getExplicitNamespacesin classMode- Parameters:
pool- the NamePool for the configuration- Returns:
- the set of all namespace URIs of names explicitly matched by rules in this mode
-
allocateAllBindingSlots
Allocate slot numbers to all the external component references in this component- Overrides:
allocateAllBindingSlotsin classActor- Parameters:
pack- the containing package
-
getRule
Get the rule corresponding to a given item, by finding the best pattern match.- Specified by:
getRulein classMode- Parameters:
item- the item to be matchedcontext- the XPath dynamic evaluation context- Returns:
- the best matching rule, if any (otherwise null).
- Throws:
XPathException- if an error occurs matching a pattern
-
getStackFrameSlotsNeeded
public int getStackFrameSlotsNeeded()- Specified by:
getStackFrameSlotsNeededin classMode
-
getRule
Get the rule corresponding to a given item, by finding the best Pattern match.- Specified by:
getRulein classMode- Parameters:
item- the item to be matchedcontext- the XPath dynamic evaluation contextfilter- a filter to select which rules should be considered- Returns:
- the best matching rule, if any (otherwise null).
- Throws:
XPathException- if an error occurs
-
exportTemplateRules
Export expression structure. The abstract expression tree is written to the supplied outputstream.- Specified by:
exportTemplateRulesin classMode- Parameters:
presenter- the expression presenter used to generate the XML representation of the structure- Throws:
XPathException
-
explainTemplateRules
Explain expression structure. The abstract expression tree is written to the supplied outputstream.- Specified by:
explainTemplateRulesin classMode- Parameters:
presenter- the expression presenter used to generate the XML representation of the structure- Throws:
XPathException
-