Project

Profile

Help

Bug #4246

closed

XSLT variable contains document node with zero-length text node

Added by Michael Kay over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT conformance
Sprint/Milestone:
-
Start date:
2019-07-04
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.9, trunk
Fix Committed on Branch:
9.9, trunk
Fixed in Maintenance Release:
Platforms:

Description

The construct

<xsl:variable name="x">
  <xsl:sequence select="()"/>
</xsl:variable>

produces a document node containing a single zero-length text node child. Zero-length text nodes should never occur under the rules for constructing complex content.

Saxon is using the "TextFragment" data structure for this, and in this data structure there is always a text node even if it is empty.

This is probably one of those bugs that has been in the product "for ever".

Reported by Davud Carlisle on xsl-list.

Actions #1

Updated by Michael Kay over 5 years ago

Added two teat cases, variable-0122 and variable-0123, both currently failing.

Actions #2

Updated by Michael Kay over 5 years ago

  • Status changed from New to Resolved
  • Applies to branch 9.9, trunk added
  • Fix Committed on Branch 9.9, trunk added

Patch committed for 9.9 and trunk. The patch to DocumentInstr creates a conventional (LinkedTree) document node rather than a TextFragmentValue in the case where the text is zero-length.

Actions #3

Updated by O'Neil Delpratt over 5 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.9.1.5 added

Bug fix applied in the Saxon 9.9.1.5 maintenance release.

Actions #4

Updated by Michael Kay almost 5 years ago

  • Status changed from Closed to In Progress

These new tests are failing when bytecode generation is enabled.

Actions #5

Updated by Michael Kay almost 5 years ago

  • Status changed from In Progress to Resolved

I've moved the logic that decides whether to create a TextFragmentValue into a static factory method, which is now invoked both by the interpreted and the compiled code. Tests now passing.

Actions #6

Updated by O'Neil Delpratt almost 5 years ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 9.9.1.7 added
  • Fixed in Maintenance Release deleted (9.9.1.5)

Patch applied in the 9.9.1.7 maintenance release.

Please register to edit this issue

Also available in: Atom PDF