net.sf.saxon.om
Class SelectedElementsSpaceStrippingRule

java.lang.Object
  extended by net.sf.saxon.om.SelectedElementsSpaceStrippingRule
All Implemented Interfaces:
SpaceStrippingRule

public class SelectedElementsSpaceStrippingRule
extends Object
implements SpaceStrippingRule

A whitespace stripping rule that strips elected elements unless xml:space indicates that whitespace should be preserved.


Nested Class Summary
static class SelectedElementsSpaceStrippingRule.StripRuleTarget
           
 
Constructor Summary
SelectedElementsSpaceStrippingRule()
          Create the ruleset
 
Method Summary
 void addRule(NodeTest test, Stripper.StripRuleTarget action, StylesheetModule module, int lineNumber)
          Add a rule
 Rule getRule(NodeName nodeName)
          Get 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectedElementsSpaceStrippingRule

public SelectedElementsSpaceStrippingRule()
Create the ruleset

Method Detail

isSpacePreserving

public byte isSpacePreserving(NodeName fingerprint)
                       throws XPathException
Decide whether an element is in the set of white-space preserving element names

Specified by:
isSpacePreserving in interface SpaceStrippingRule
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.PRESERVE
module - the stylesheet module containing the rule

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).


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.