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:
javax.xml.transform.SourceLocator,ExpressionOwner,Location,org.xml.sax.Locator
public class CompoundMode extends Mode
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, RECOVER_WITH_WARNINGS, UNNAMED_MODE_NAME
-
-
Constructor Summary
Constructors Constructor Description CompoundMode(Mode base, SimpleMode overrides)Create a compound Mode
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidallocateAllBindingSlots(StylesheetPackage pack)Allocate 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.SimpleModegetActivePart()Get the active component of this mode.BuiltInRuleSetgetBuiltInRuleSet()Get the built-in template rules to be used with this Mode in the case where there is no explicit template rulejava.util.Set<java.lang.String>getExplicitNamespaces(NamePool pool)Get the "explicit namespaces" matched by this mode.intgetMaxPrecedence()Get the maximum precedence of the rules in this modeintgetMaxRank()Get the highest rank of the rules in this modeRulegetRule(Item item, XPathContext context)Get the rule corresponding to a given item, by finding the best pattern match.RulegetRule(Item item, XPathContext context, Mode.RuleFilter filter)Get the rule corresponding to a given item, by finding the best Pattern match.intgetStackFrameSlotsNeeded()booleanisEmpty()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, isModeTracing, isMustBeTyped, isUnnamedMode, makeNewContext, setAccumulators, setDefaultResultType, setHasRules, setModeTracing, setRecoveryPolicy, setStreamable
-
Methods inherited from class net.sf.saxon.expr.instruct.Actor
allocateBindingSlotsRecursive, getBody, getChildExpression, getColumnNumber, getComponentName, getDeclaredVisibility, getLineNumber, getLocation, getPackageData, getProperties, getProperty, getPublicId, getRetainedStaticContext, getStackFrameMap, getSystemId, getTracingTag, isExportable, makeDeclaringComponent, obtainDeclaringComponent, saveLocation, setBody, setChildExpression, setColumnNumber, setDeclaredVisibility, setDeclaringComponent, setLineNumber, setPackageData, setRetainedStaticContext, setStackFrameMap, setSystemId
-
-
-
-
Constructor Detail
-
CompoundMode
public CompoundMode(Mode base, SimpleMode overrides)
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 Detail
-
getBuiltInRuleSet
public BuiltInRuleSet 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
public SimpleMode 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
public void computeRankings(int start) throws XPathExceptionCompute 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
public void processRules(Mode.RuleAction action) throws XPathException
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
public java.util.Set<java.lang.String> getExplicitNamespaces(NamePool pool)
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
public void allocateAllBindingSlots(StylesheetPackage pack)
Allocate slot numbers to all the external component references in this component- Overrides:
allocateAllBindingSlotsin classActor- Parameters:
pack- the containing package
-
getRule
public Rule getRule(Item item, XPathContext context) throws XPathException
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
public Rule getRule(Item item, XPathContext context, Mode.RuleFilter filter) throws XPathException
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
public void exportTemplateRules(ExpressionPresenter presenter) throws XPathException
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
public void explainTemplateRules(ExpressionPresenter presenter) throws XPathException
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
-
-