Actions
Bug #4667
closedtransform() requires cache to be disabled in some cases?
Status:
Won't fix
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2020-08-03
Due date:
% Done:
0%
Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Description
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.
The spec says, "no effect on the result".
However, on Saxon, the cache
option in transform()
does have some effect on the result.
Is it the user's responsibility to disable cache in some cases on Saxon? If so, when?
Here is a complete repro (a file called test.xsl
):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet exclude-result-prefixes="#all" 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" omit-xml-declaration="yes" />
<xsl:template name="xsl:initial-template">
<xsl:call-template name="scenario">
<xsl:with-param name="location" select="'UK'" />
</xsl:call-template>
<xsl:call-template name="scenario">
<xsl:with-param name="location" select="'FR'" />
</xsl:call-template>
<xsl:call-template name="scenario">
<xsl:with-param name="location" select="'FR'" />
<xsl:with-param name="cache" select="false()" />
</xsl:call-template>
</xsl:template>
<xsl:template name="scenario">
<xsl:param as="xs:string" name="location" />
<xsl:param as="xs:boolean" name="cache" select="true()" />
<!--
******************************************************************
All the external files are available via /xsl:stylesheet/@xml:base
******************************************************************
-->
<xsl:variable as="map(xs:string, item()*)" name="transform-options">
<xsl:map>
<xsl:map-entry key="'cache'" select="$cache" />
<xsl:map-entry key="'delivery-format'" select="'raw'" />
<xsl:map-entry key="'source-node'" select="doc('data.xml')" />
<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')">
<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 = ''{$location}'''" />
</package>
</xsltPackages>
</configuration>
</xsl:map-entry>
</xsl:map>
</xsl:map-entry>
</xsl:map>
</xsl:variable>
<scenario>
<xsl:value-of select="transform($transform-options)?output//location" />
</scenario>
</xsl:template>
</xsl:stylesheet>
$ java -jar saxon-he-10.1.jar -it -xsl:test.xsl
<scenario>UK</scenario>
<scenario>UK</scenario>
<scenario>FR</scenario>
If "no effect on the result" were true, the 2nd and the 3rd in the output would be the same. That is:
<scenario>UK</scenario>
<scenario>FR</scenario>
<scenario>FR</scenario>
Please register to edit this issue
Actions