Whitespace stripping in DocumentBuilder ignores xml:space
During Saxon-CS development I created a new unit test
TestDocumentBuilder.TestCustomWhitespacePolicyWithXmlSpace and found that it fails when retrofitted to Saxon 10. The test is designed to ensure that no whitespace stripping occurs for descendants of an element with @xml:space="preserve".
The Stripper class, which is implementing the whitespace stripping, is designed to take account of xml:space, but in this case it seems to ignore it. Note that this class is also used for standard XSLT-based whitespace stripping, so the bug could affect that too.
#1 Updated by Michael Kay 2 months ago
The problem is specific to the API
WhitespaceStrippingPolicy.makeCustomPolicy(), which supplies a predicate used to decide whether whitespace should be stripped or preserved. There's nothing in the documentation of this API that says whether xml:space is honoured or not, and it turns out that it isn't. So I think I'll just document the current behaviour.
Please register to edit this issue