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 Details

    • SelectedElementsSpaceStrippingRule

      public SelectedElementsSpaceStrippingRule()
      Create the ruleset
  • Method Details

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