Project

Profile

Help

Bug #5097

closed

Tracing with -T produces wrong output for xsl:on-empty instructions

Added by Michael Kay over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT conformance
Sprint/Milestone:
-
Start date:
2021-09-17
Due date:
% Done:

100%

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

Description

The xsl:on-empty instruction "fires" when the containing instruction (a sequence constructor) produces an empty result. Injecting a trace instruction between xsl:on-empty and its parent instruction changes this relationship: it makes xsl:on-empty the only operand of its parent instruction, which means it always fires.

Actions #1

Updated by Michael Kay over 2 years ago

  • Status changed from New to In Progress

Most of the failures in the on-empty test set can be eliminated by marking the OperandRole of an onEmpty instruction within the containing ConditionalBlock with the CONSTRAINED_CLASS property which (following the fix to bug #5093) inhibits injection of a trace instruction.

Actions #2

Updated by Michael Kay over 2 years ago

The remaining failures are the test cases on-empty-106X and on-empty-107X. There seems to be a problem here that is only indirectly related to tracing. When on-empty-106 is run without tracing, we get a warning:

Warning on line 6 column 43 of on-empty-106.xsl: SXWN9000 The result of the sequence constructor will never be empty, so xsl:on-empty instructions will never be evaluated, and xsl:on-non-empty instructions will always be evaluated

This means that the optimiser has basically made the decisions at compile time, which in turn means that the run-time logic is not being exercised by the test. The run-time logic looks incorrect, and the bug would be equally exposed by a test that put xsl:attribute inside a conditional rather than a trace instruction.

I have created tests on-empty-106e and on-empty-107e to demonstrate this: these are failing even without tracing enabled.

Fixed SignificantItemDetector so that calls on attribute() and namespace() invoke start() to indicate that non-empty content has been found.

With this change all tests in test set on-empty pass both with and without the -T option.

Actions #3

Updated by Michael Kay over 2 years ago

  • Status changed from In Progress to Resolved
  • Fix Committed on Branch 10, trunk added
Actions #4

Updated by Debbie Lockett about 2 years ago

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

Bug fix applied in the Saxon 10.7 maintenance release.

Please register to edit this issue

Also available in: Atom PDF