Bug #1651
closedXSLT space-stripping interferes with validation
100%
Description
When a validated document tree is supplied as input to a stylesheet that uses xsl:strip-space to strip selected whitespace text nodes, Saxon does not rebuild the tree to physically remove the selected whitespace nodes, but instead wraps the supplied tree in a layer that causes the affected nodes to be skipped when necessary. This mechanism is not correctly preserving type annotations of nodes that have been validated against a schema; in particular, where nodes are subtypes of xs:string, or are unions of types derived from xs:string, the type annotation of the original node is replaced with type annotation of xs:string.
This does not occur when processing from the command line, or when the input to the transformation is supplied as a StreamSource or SAXSource, because in this case whitespace stripping and validation both occur while building the tree. The problem only occurs when a validated and type-annotated tree is built as a separate operation independent of the transformation. (Note that in this case it is usually unecessary to use xsl;strip-space, because insignificant whitespace - that is, whitespace in elements with element-only content - is stripped anyway in the course of validation.)
A patch has been created and tested on the 9.5 branch, and will be retrofitted to 9.4. Affects method SpaceStrippedNode.atomize().
Updated by Michael Kay over 11 years ago
- Category set to Schema-Aware processing
- Status changed from New to Resolved
- % Done changed from 0 to 100
Updated by Michael Kay over 11 years ago
The patch failed to address a related issue, which is the rule that xsl:strip-space is ignored in the case of an element whose content is either a simple type, or a complex type with simple content. A further patch to SpaceStrippedNode is being committed to address this case.
Updated by O'Neil Delpratt about 11 years ago
- Status changed from Resolved to Closed
- Fixed in version set to 9.4.0.7
Bug closed. Fixed in Saxon maintenance release 9.4.0.7
Please register to edit this issue