Project

Profile

Help

Bug #6428

closed

Output of xsl:on-non-empty changes when using TraceListener

Added by Adrian Bird 4 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2024-05-16
Due date:
% Done:

100%

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

Description

When using the Saxon TraceListener I get different output from xsl:on-non-empty compared to when not using the TraceListener. Test case on-non-empty-008.xsl shows the issue:

<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <out>   
    <xsl:for-each select="/*/thing">
      <item><xsl:value-of select="name()"/></item>
    </xsl:for-each>
    <xsl:on-non-empty>
      <p>There are some things</p>
    </xsl:on-non-empty>  
  </out>
</xsl:template>
</xsl:stylesheet>

The data is:

<doc> <item>a</item> <item>b</item> <item>c</item> </doc>

Without the TraceListener configured the result is:

<out/>

With the TraceListener configured the result is:

<out>
<p>There are some things</p>
</out>

With the TraceListener and default optimisation setting I also get the message SXWN9029.

With the TraceListener and no optimisation, -opt:0, I don't get the message SXWN9029 but do still get the wrong output.

Adrian

Actions #1

Updated by Michael Kay 4 months ago

Thanks.

The logic in ConditionalBlock.optimize() is doing getChildExpression(c) instanceof OnNonEmptyExpr which is giving the wrong answer because the OnNonEmptyExpr has been wrapped in a TraceExpression.

I think we should avoid wrapping an OnEmptyExpr or OnNonEmptyExpr in a TraceExpression.

Actions #2

Updated by Michael Kay 4 months ago

  • Category set to Diagnostics
  • Status changed from New to Resolved
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal
  • Applies to branch 12, trunk added
  • Fix Committed on Branch 12, trunk added
  • Platforms Java added
Actions #3

Updated by O'Neil Delpratt 3 months ago

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

Bug fix applied in the Saxon 12.5 Maintenance release.

Please register to edit this issue

Also available in: Atom PDF