Project

Profile

Help

Bug #6302

open

Saxon (HE; Java) trace not well-formed when XSLT uses transform function

Added by A Galtman 5 months ago. Updated 4 months ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2023-12-21
Due date:
% Done:

0%

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

Description

(I alluded to this in my 12/21/23 comment in https://saxonica.plan.io/issues/6295 but it seems different enough that I'm making a separate issue for it rather than assume that the fix for 6295 is enough.)

The transform() function seems to cause the Saxon trace not to be well-formed.

Sample XSLT 1, transform-function.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:my="my-ns"
  exclude-result-prefixes="#all"
  version="3.0">

  <xsl:template name="xsl:initial-template">
    <xsl:variable name="transform-options" as="map(xs:string, item()*)">
      <xsl:map>
        <xsl:map-entry key="'delivery-format'" select="'raw'"/>
        <xsl:map-entry key="'stylesheet-location'">target-stylesheet-small.xsl</xsl:map-entry>
        <xsl:map-entry key="'function-params'" select="[()]"/>
        <xsl:map-entry key="'initial-function'" select="QName('my-ns', 'my:fcn')"/>
      </xsl:map>
    </xsl:variable>
    <xsl:sequence select="transform($transform-options)?output"/>
  </xsl:template>
</xsl:stylesheet>

Sample XSLT 2, target-stylesheet-small.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:fn="http://www.w3.org/2005/xpath-functions"
  xmlns:my="my-ns"
  exclude-result-prefixes="#all"
  version="3.0">
  
  <xsl:function name="my:fcn" visibility="public" as="xs:string">
    <xsl:param name="p" as="empty-sequence()"/>
    <xsl:sequence select="'output'"/>
  </xsl:function>
  
</xsl:stylesheet>

Saxon command

java -cp "%SAXON_CP%" net.sf.saxon.Transform -opt:0 -T -Tlevel:high -it -xsl:transform-function.xsl 2>transform-function-traceresult.xml

I'm using Saxon-HE 12.4.

Trace Result

<trace saxon-version="12.4" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:template name="xsl:initial-template" line="9" column="45" module="transform-function.xsl">
  <xsl:variable name="transform-options" line="10" column="73" module="transform-function.xsl">
   <trace text="target-stylesheet-small.xsl" line="13" column="52" module="transform-function.xsl">
   </trace>
<trace saxon-version="12.4" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:function arity="1" name="my:fcn" line="9" column="66" module="target-stylesheet-small.xsl">
    </xsl:function>
   </xsl:variable>
  </xsl:template>
</trace>

Please register to edit this issue

Also available in: Atom PDF