net.sf.saxon.om

## Class SelectedElementsSpaceStrippingRule

- java.lang.Object
- - 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.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SelectedElementsSpaceStrippingRule(boolean rejectDuplicates)` Create the ruleset

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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(boolean rejectDuplicates)

      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)
                       throws XPathException

      Add a rule
      Parameters:
        `test` - a NodeTest (*, *:local, prefix:*, or QName)
        `action` - StripRuleTarget.STRIP or StripRuleTarget.PRESERVE
        `module` - the stylesheet module containing the rule
        `lineNumber` - the line where the strip-space or preserve-space instruction appears
      Throws:
        `XPathException` - if this rule is a conflicting duplicate

    - #### 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-2013 Saxonica Limited. All rights reserved.