Package net.sf.saxon.om
Class SelectedElementsSpaceStrippingRule
- java.lang.Object
-
- net.sf.saxon.om.SelectedElementsSpaceStrippingRule
-
- All Implemented Interfaces:
SpaceStrippingRule
public class SelectedElementsSpaceStrippingRule extends java.lang.Object implements SpaceStrippingRule
A whitespace stripping rule that strips elected elements unless xml:space indicates that whitespace should be preserved.
-
-
Constructor Summary
Constructors Constructor Description SelectedElementsSpaceStrippingRule(boolean rejectDuplicates)
Create the ruleset
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRule(NodeTestPattern pattern, Stripper.StripRuleTarget action, int precedence, int minImportPrecedence)
void
addRule(NodeTest test, Stripper.StripRuleTarget action, StylesheetModule module, int lineNumber)
Add a rulevoid
export(ExpressionPresenter presenter)
Export this rule as part of an exported stylesheetjava.util.Iterator<Rule>
getRankedRules()
Get all the rules in rank order, highest-ranking rules firstRule
getRule(NodeName nodeName)
Get the rule corresponding to a given element node, by finding the best pattern match.int
isSpacePreserving(NodeName fingerprint, SchemaType schemaType)
Decide whether an element is in the set of white-space preserving element namesProxyReceiver
makeStripper(Receiver next)
Make a filter to implement these space-stripping rules, or null if no filtering is necessary
-
-
-
Method Detail
-
isSpacePreserving
public int isSpacePreserving(NodeName fingerprint, SchemaType schemaType) throws XPathException
Decide whether an element is in the set of white-space preserving element names- Specified by:
isSpacePreserving
in interfaceSpaceStrippingRule
- Parameters:
fingerprint
- Identifies the name of the element whose whitespace is to be preservedschemaType
-- Returns:
- ALWAYS_PRESERVE if the element is in the set of white-space preserving element types, ALWAYS_STRIP if the element is to be stripped regardless of the xml:space setting, and STRIP_DEFAULT otherwise
- Throws:
XPathException
- if the rules are ambiguous and ambiguities are to be reported as errors
-
addRule
public void addRule(NodeTest test, Stripper.StripRuleTarget action, StylesheetModule module, int lineNumber) throws XPathException
Add a rule- Parameters:
test
- a NodeTest (*, *:local, prefix:*, or QName)action
- StripRuleTarget.STRIP or StripRuleTarget.PRESERVEmodule
- the stylesheet module containing the rulelineNumber
- the line where the strip-space or preserve-space instruction appears- Throws:
XPathException
- if this rule is a conflicting duplicate
-
addRule
public void addRule(NodeTestPattern pattern, Stripper.StripRuleTarget action, int precedence, int minImportPrecedence) throws XPathException
- Throws:
XPathException
-
getRule
public Rule getRule(NodeName nodeName)
Get the rule corresponding to a given element node, by finding the best pattern match.- Parameters:
nodeName
- the name of the element node to be matched- Returns:
- the best matching rule, if any (otherwise null).
-
getRankedRules
public java.util.Iterator<Rule> getRankedRules()
Get all the rules in rank order, highest-ranking rules first- Returns:
- the rules in rank order
-
makeStripper
public ProxyReceiver makeStripper(Receiver next)
Make a filter to implement these space-stripping rules, or null if no filtering is necessary- Specified by:
makeStripper
in interfaceSpaceStrippingRule
- Parameters:
next
-- Returns:
- a filter in the form of a ProxyReceiver, or null
-
export
public void export(ExpressionPresenter presenter) throws XPathException
Export this rule as part of an exported stylesheet- Specified by:
export
in interfaceSpaceStrippingRule
- Parameters:
presenter
- the output handler- Throws:
XPathException
-
-