SaxonCS by Saxonica Ltd.

<PackageReference Include="SaxonCS" Version="11.0.1" />

.NET API 7,699,968 bytes

 WhitespacePolicy

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

No whitespace is stripped

public static WhitespacePolicy StripAll

All whitespace text nodes are stripped

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 means that no other value has been specifically requested

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

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.