Saxon.Api

 

 

Saxon.Api

Class WhitespacePolicy


public class WhitespacePolicy

WhitespacePolicy is a class defining the possible policies for handling whitespace text nodes in a source document.

Field Summary

static WhitespacePolicy PreserveAll

No whitespace is stripped

static WhitespacePolicy StripAll

All whitespace text nodes are stripped

static WhitespacePolicy StripIgnorable

Whitespace text nodes other than whitespace within mixed content are stripped. Note that whitespace in text-only content models is considered ignorable under this definition.

static WhitespacePolicy Unspecified

Unspecified means that no other value has been specifically requested

 

Constructor Summary

WhitespacePolicy (XsltPackage pack)

Construct the whitespace-stripping policy for a particular XSLT package, as defined by its xsl:strip-space and xsl:preserve-space declarations

 

Property Summary

 net.sf.saxon.om.SpaceStrippingRule Implementation

 

Method Summary

static WhitespacePolicy MakeCustomPolicy (Predicate<QName> elementTest)

Create a custom whitespace stripping policy, by supplying a predicate that indicates for any given element, whether whitespace text nodes among its children should be stripped or preserved. Note that this decision ignores any xml:space attributes that might be present, and the decision applies only to immediate children, not to descendants.

 

Field Detail

PreserveAll

public static WhitespacePolicy PreserveAll

No whitespace is stripped

StripAll

public static WhitespacePolicy StripAll

All whitespace text nodes are stripped

StripIgnorable

public static WhitespacePolicy StripIgnorable

Whitespace text nodes other than whitespace within mixed content are stripped. Note that whitespace in text-only content models is considered ignorable under this definition.

Unspecified

public static WhitespacePolicy Unspecified

Unspecified means that no other value has been specifically requested

Constructor Detail

WhitespacePolicy

public WhitespacePolicy(XsltPackage pack)

Construct the whitespace-stripping policy for a particular XSLT package, as defined by its xsl:strip-space and xsl:preserve-space declarations

Parameters:

pack - The package containing the relevant xsl:strip-space and xsl:preserve-space declarations

Property Detail

Implementation

public net.sf.saxon.om.SpaceStrippingRule Implementation {get; }

Method Detail

MakeCustomPolicy

public static WhitespacePolicy MakeCustomPolicy(Predicate<QName> elementTest)

Create a custom whitespace stripping policy, by supplying a predicate that indicates for any given element, whether whitespace text nodes among its children should be stripped or preserved. Note that this decision ignores any xml:space attributes that might be present, and the decision applies only to immediate children, not to descendants.

Parameters:

elementTest - a predicate applied to element names, which should return true if whitespace-only text node children of the element are to be stripped, false if they are to be retained.

Returns:

A WhitespacePolicy object