Project

Profile

Help

Support #4887

Question about the tracing functionality of Saxon

Added by Maarten Kroon 28 days ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2021-01-29
Due date:
% Done:

0%

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

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

Please register to edit this issue

Also available in: Atom PDF