Package net.sf.saxon.om
Class SelectedElementsSpaceStrippingRule
java.lang.Object
net.sf.saxon.om.SelectedElementsSpaceStrippingRule
- All Implemented Interfaces:
SpaceStrippingRule
A whitespace stripping rule that strips elected elements unless xml:space indicates that whitespace
should be preserved.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRule
(NodeTest test, Stripper.StripRuleTarget action, StylesheetModule module, int lineNumber) Add a ruleGet the rule corresponding to a given element node, by finding the best pattern match.byte
isSpacePreserving
(NodeName fingerprint) Decide whether an element is in the set of white-space preserving element names
-
Constructor Details
-
SelectedElementsSpaceStrippingRule
public SelectedElementsSpaceStrippingRule()Create the ruleset
-
-
Method Details
-
isSpacePreserving
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 preserved- 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) Add a rule- Parameters:
test
- a NodeTest (*, *:local, prefix:*, or QName)action
- StripRuleTarget.STRIP or StripRuleTarget.PRESERVEmodule
- the stylesheet module containing the rule
-
getRule
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).
-