cache=true() interferes transform() with static params?

AirQuick <[email protected]>
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
https://www.w3.org/TR/xpath-functions-31/#func-transform
> cache ... This option has no effect on the result of the transformation but may affect efficiency.

Contrary to that "no effect on the result" statement, the transformation result of the stylesheet below depends on the 'cache' value in this map-entry in the "scenario2" template:

>         <xsl:map-entry key="'cache'" select="false()" />

When false (<xsl:map-entry key="'cache'" select="false()" />,

$ java -jar saxon-he-10.1.jar -it -xsl:test.xsl
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <report>
      <employee>
         <location>UK</location>
         <name>Bob</name>
      </employee>
   </report>
   <report>
      <employee>
         <location>FR</location>
         <name>Alice</name>
      </employee>
   </report>
</report>

When true (<xsl:map-entry key="'cache'" select="true()" />),

$ java -jar saxon-he-10.1.jar -it -xsl:test.xsl
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <report>
      <employee>
         <location>UK</location>
         <name>Bob</name>
      </employee>
   </report>
   <report>
      <employee>
         <location>UK</location>
         <name>Bob</name>
      </employee>
   </report>
</report>


Stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0"
  xml:base="https://raw.githubusercontent.com/xspec/xspec/9fa77d2dc6fc94e50bbff38112e3252769c663a1/test/xslt-package/filter/"
  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output indent="yes" />

  <xsl:template name="xsl:initial-template">
    <report>
      <xsl:call-template name="scenario1" />
      <xsl:call-template name="scenario2" />
    </report>
  </xsl:template>

  <xsl:template name="scenario1">
    <xsl:variable as="document-node()" name="saxon-config">
      <xsl:document>
        <configuration xmlns="http://saxon.sf.net/ns/configuration">
          <xsltPackages>
            <package name="http://example.org/filter.xsl"
              sourceLocation="{resolve-uri('package/filter.xsl')}" version="1.0">
              <withParam name="filter" select="'location = ''UK'''" />
            </package>
          </xsltPackages>
        </configuration>
      </xsl:document>
    </xsl:variable>
    <xsl:variable as="map(xs:string, item()*)" name="transform-options">
      <xsl:map>
        <xsl:map-entry key="'delivery-format'" select="'raw'" />
        <xsl:map-entry key="'stylesheet-location'" select="resolve-uri('use.xsl')" />
        <xsl:map-entry key="'vendor-options'">
          <xsl:map>
            <xsl:map-entry key="QName('http://saxon.sf.net/', 'configuration')"
              select="$saxon-config" />
          </xsl:map>
        </xsl:map-entry>
        <xsl:map-entry key="'source-node'" select="doc('data.xml')" />
      </xsl:map>
    </xsl:variable>
    <xsl:sequence select="transform($transform-options)?output" />
  </xsl:template>

  <xsl:template name="scenario2">
    <xsl:variable as="document-node()" name="saxon-config">
      <xsl:document>
        <configuration xmlns="http://saxon.sf.net/ns/configuration">
          <xsltPackages>
            <package name="http://example.org/filter.xsl"
              sourceLocation="{resolve-uri('package/filter.xsl')}" version="1.0">
              <withParam name="filter" select="'location = ''FR'''" />
            </package>
          </xsltPackages>
        </configuration>
      </xsl:document>
    </xsl:variable>
    <xsl:variable as="map(xs:string, item()*)" name="transform-options">
      <xsl:map>
        <xsl:map-entry key="'cache'" select="false()" />
        <xsl:map-entry key="'delivery-format'" select="'raw'" />
        <xsl:map-entry key="'stylesheet-location'" select="resolve-uri('use.xsl')" />
        <xsl:map-entry key="'vendor-options'">
          <xsl:map>
            <xsl:map-entry key="QName('http://saxon.sf.net/', 'configuration')"
              select="$saxon-config" />
          </xsl:map>
        </xsl:map-entry>
        <xsl:map-entry key="'source-node'" select="doc('data.xml')" />
      </xsl:map>
    </xsl:variable>
    <xsl:sequence select="transform($transform-options)?output" />
  </xsl:template>

</xsl:stylesheet>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.