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.
-
Constructor Summary
ConstructorsConstructorDescriptionSelectedElementsSpaceStrippingRule
(boolean rejectDuplicates) Create the ruleset -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 stylesheetGet all the rules in rank order, highest-ranking rules firstGet 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 namesmakeStripper
(Receiver next) Make a filter to implement these space-stripping rules, or null if no filtering is necessary
-
Constructor Details
-
SelectedElementsSpaceStrippingRule
public SelectedElementsSpaceStrippingRule(boolean rejectDuplicates) Create the ruleset- Parameters:
rejectDuplicates
- indicates whether duplicate conflicting rules are a static error
-
-
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 preservedschemaType
- the type annotation of the element- 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
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
Get all the rules in rank order, highest-ranking rules first- Returns:
- the rules in rank order
-
makeStripper
Make a filter to implement these space-stripping rules, or null if no filtering is necessary- Specified by:
makeStripper
in interfaceSpaceStrippingRule
- Parameters:
next
- the Receiver that is to receive the filtered event stream- Returns:
- a filter in the form of a ProxyReceiver, or null
-
export
Export this rule as part of an exported stylesheet- Specified by:
export
in interfaceSpaceStrippingRule
- Parameters:
presenter
- the output handler- Throws:
XPathException
- if an error is detected
-