Project

Profile

Help

Bug #4887

closed

Question about the tracing functionality of Saxon

Added by Maarten Kroon about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2021-01-29
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

I have a question about the tracing functionality of Saxon 10.3 (Java). My own custom Tracelistener but also the standard XSLTTraceListener does not seem to trace expressions within templates that have a match attribute but do not have a name attribute.

I made a simple test case. My input document is:

<test/>

My stylesheet is:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  version="3.0">
 
  <xsl:template match="/">
    <root>
      <xsl:call-template name="test1"/>
      <xsl:apply-templates/>  
    </root>
  </xsl:template>
 
  <xsl:template name="test1">
    <xsl:sequence select="trace('trace1', 'trace1')"/>
    <test1>TEST1</test1>
  </xsl:template>
 
  <xsl:template match="/*">
    <xsl:sequence select="trace('trace2', 'trace2')"/>
    <test2>TEST2</test2>
  </xsl:template>
 
</xsl:stylesheet>

I run the transformation with:

java -jar saxon-he-10.3.jar -s:test.xml -xsl:test.xsl -T:net.sf.saxon.trace.XSLTTraceListener -Tlevel:high -o:out.xml -traceout:trace.xml

The expressions within the template with name "test1" are traced, but the expressions within template with match="/*" are not.

But if I add a name attribute to the template with match="/*" like this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  version="3.0">
 
  <xsl:template match="/">
    <root>
      <xsl:call-template name="test1"/>
      <xsl:apply-templates/>  
    </root>
  </xsl:template>
 
  <xsl:template name="test1">
    <xsl:sequence select="trace('trace1', 'trace1')"/>
    <test1>TEST1</test1>
  </xsl:template>
 
  <xsl:template name="unused" match="/*">
    <xsl:sequence select="trace('trace2', 'trace2')"/>
    <test2>TEST2</test2>
  </xsl:template>
 
</xsl:stylesheet> 

the expressions in template with mach="/*" are traced. How can I trace expressions within a template that only has a match attribute but not a name attribute?

I noticed that the trace functionality of Saxon 9.9.1 does indeed trace expressions within templates that have no name.

Kind regards, Maarten

Actions #1

Updated by Michael Kay about 3 years ago

  • Tracker changed from Support to Bug
  • Category set to Diagnostics
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal

Sorry about the delay in responding.

On first attempts, I wasn't able to reproduce this. It turns out the problem only happens in Saxon-HE.

Actions #2

Updated by Michael Kay about 3 years ago

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

Now fixed.

The problem also affected EE when run with -jit:off; trace code was being injected into template rules only when JIT-compiled, not when eagerly compiled.

Actions #3

Updated by O'Neil Delpratt about 3 years ago

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

Bug fix applied to Saxon 10.5 maintenance release.

Please register to edit this issue

Also available in: Atom PDF