Project

Profile

Help

Support #5214

closed

Ghost function calls in trace listener

Added by Radu Coravu over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2022-01-19
Due date:
% Done:

0%

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

Description

Whenever there are function calls in the XSLT like for example:

 <xsl:value-of select="substring(local-name(), 2)"/>

I want the trace listener to also give callbacks for the function calls. So I patched the method "net.sf.saxon.Configuration.setCompileWithTracing(boolean)" to also inject a trace expression around function calls:

                defaultXsltCompilerInfo.setCodeInjector(new XSLTTraceCodeInjector() {
                	//OXYGEN PATCH FOR EXM-46382, trace inside function calls.
                 /**
                   * @see net.sf.saxon.trace.XSLTTraceCodeInjector#isApplicable(net.sf.saxon.expr.Expression)
                   */
                  @Override
                  protected boolean isApplicable(Expression exp) {
                    return exp instanceof FunctionCall || super.isApplicable(exp); 
                  }
                });

but now in an XSLT like this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:template match="/">
        <xsl:apply-templates select="//*"/>
    </xsl:template>
    <xsl:template match="*">
        <xsl:variable name="x">
            <xsl:choose>
                <xsl:when test="position() = 1">stop</xsl:when>
            </xsl:choose>
        </xsl:variable>
        <xsl:value-of select="$x"/>
    </xsl:template>
</xsl:stylesheet>

on this line:

    <xsl:value-of select="$x"/>

I get a ghost callback for a fn:string-join inside the select attribute value, probably because Saxon does that internally to compose the value-of but somehow it's not 100% ok to show that to the end user.

Please register to edit this issue

Also available in: Atom PDF