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

AirQuick <[email protected]>
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
Due to this behavior, right now XSpec always has to disable cache.
 Under what condition can we enable cache safely on Saxon when invoking transform()? If the condition were documented somewhere, we could enable cache selectively based on it.

----- Original message -----
From: AirQuick <[email protected]>
To: [email protected]
Subject: Re: [saxon] cache=true() interferes transform() with static params?
Date: Saturday, July 04, 2020 21:11

The static parameters are embedded in the stylesheet as a part of vendor-options: 

> <withParam name="filter" select="'location = ''UK'''" />

> <withParam name="filter" select="'location = ''FR'''" />

The stylesheet is a complete repro with all the external files referenced via /xsl:stylesheet/@xml:base.


----- Original message -----
From: Michael Kay <mike-JkSD5nQpfvpWk0Htik3J/[email protected]>
To: Mailing list for the SAXON XSLT and XQuery processor <[email protected]>
Subject: Re: [saxon] cache=true() interferes transform() with static params?
Date: Saturday, July 04, 2020 20:43

You mention static params in the title but nowhere else... I don't know where to find the static params.

Could you please supply a complete repro? There seem to be other files needed, like data.xml and test.xsl.

Also, it's much easier for us to manage issues like this through to completion if you raise them as an issue on saxonica.plan.io.

Michael Kay
Saxonica

> On 4 Jul 2020, at 10:53, AirQuick <[email protected]> wrote:
> 
> 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>
> 
> 
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help 

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help
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.