Project

Profile

Help

Bug #3472

closed

Somehow notify TraceListener that an empty xsl:template is being matched

Added by Radu Coravu over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2017-10-06
Due date:
% Done:

100%

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

Description

Based on this discussion:

https://www.oxygenxml.com/forum/viewtopic.php?f=2&t=14985&p=44326#p44320

Let's say I have this XML document:

<personnel>
    <person>                
        <name>
            <family>Anderson</family>
        </name>
    </person>
</personnel>

and this XSLT stylesheet:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="family"/>
    <xsl:template match="/">
        <root><xsl:apply-templates select="//family"/></root>
    </xsl:template>
</xsl:stylesheet>

and we run the transformation with the trace listener set on the transformer (as the Oxygen XSLT debugger does).

There is no event given to the trace listener about the xsl:template which matches "family" and does nothing (filters it out).

This behavior is consistent for Saxon 6 and 9.

Xalan does emmit an event for this.

How about having an extra event emitted for empty xsl:templates as they have no instructions inside?

Actions #1

Updated by Michael Kay over 6 years ago

  • Category set to Diagnostics
  • Status changed from New to In Progress
  • Assignee set to Michael Kay
  • Applies to branch 9.8, trunk added
  • Fix Committed on Branch 9.8, trunk added

First thing stopping this working is that XSLTemplate.refineTemplateBody() checks whether tracing is enabled at the Configuration level rather than the compiler level. In my test case it's set at the compiler level only, so this is failing.

When we fix that, we get as far as TraceCodeInjector.inject() and it does nothing because the relevant expression is an empty sequence and we never trace execution of literals. Seems we can fix that by adding the condition " and not( construct = template or function ) ".

Applied these two changes on the 9.8 and 9.9 branches.

There are more places, especially on the XQuery side, where we examine the configuration-wide isCompileForTracing() flag rather than the option that is local to a particular compilation. Leaving the bug open for these to be fixed.

Actions #2

Updated by Radu Coravu over 6 years ago

Thanks Michael, after we switch to using Saxon 9.8 in Oxygen I will go back to this issue and test how things work in our debugger with your changes implemented.

Actions #3

Updated by Michael Kay over 6 years ago

  • Status changed from In Progress to Resolved
  • Priority changed from Low to Normal

Reviewed the changes made and decided they are adequate.

Actions #4

Updated by O'Neil Delpratt over 6 years ago

  • % Done changed from 0 to 100

Bug fix applied in the Saxon 9.8.0.7 maintenance release.

Actions #5

Updated by O'Neil Delpratt over 6 years ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 9.8.0.7 added

Please register to edit this issue

Also available in: Atom PDF