You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then the compiled test is invalid. See sample code, below. The log includes these error messages:
run-xslt-test:
[echo] Running XSLT Tests...
[java] Syntax error at char 9 in {map{'key': 'myvalue'} in expression in x:param/@select on line 46 column 69 of map_param.xsl:
[java] XPST0003: Unexpected token ":" beyond end of expression
[java] Syntax error at char 9 in {map{'key': 'myvalue'} in expression in x:param/@select on line 63 column 69 of map_param.xsl:
[java] XPST0003: Unexpected token ":" beyond end of expression
[java] Errors were reported during stylesheet compilation
From a quick look, I think the bug may be related to the <xsl:template match="x:context | x:param" mode="x:report"> template in compiler/generate-xspec-tests.xsl. I suspect that the <xsl:template match="@select" mode="x:report"> template does not get reached for x:param inside x:context.
To reproduce problem:
XSpec code
<?xml version="1.0" encoding="UTF-8"?>
<x:descriptionxmlns:x="http://www.jenitennison.com/xslt/xspec"xmlns:map="http://www.w3.org/2005/xpath-functions/map"xslt-version="3.0"stylesheet="map_param.xsl">
<!-- Build failure if parameter passed to template rule uses map{'key': 'value'} syntax in @select --><!-- The commented-out scenarios below are a problem. The uncommented scenarios represent a potential workaround followed by a similar usage that is not a problem. --><!-- ======================================================================= --><!-- The following scenarios have a build error in Oxygen, even if marked as pending. <x:scenario label="Testing a moded template with a map parameter" pending="error"> <x:context mode="mymode"> <myelement/> <x:param name="myparam" select="map{'key': 'myvalue'}"/> </x:context> <x:expect label="has a build error if map parameter uses map{} syntax">myvalue</x:expect> </x:scenario> <x:scenario label="Testing a template rule with a map parameter" pending="error"> <x:context> <myelement/> <x:param name="myparam" select="map{'key': 'myvalue'}"/> </x:context> <x:expect label="has a build error if map parameter uses map{} syntax">myvalue</x:expect> </x:scenario>-->
<x:scenariolabel="Testing a moded template with a map parameter">
<x:contextmode="mymode">
<myelement/>
<x:paramname="myparam"select="map:merge(( map:entry('key1','myvalue1'), map:entry('key2','myvalue2'), map:entry('key','myvalue') ))"/>
</x:context>
<x:expectlabel="succeeds if map parameter uses map:merge">myvalue</x:expect>
</x:scenario>
<x:scenariolabel="Testing a template rule with a map parameter">
<x:context>
<myelement/>
<x:paramname="myparam"select="map:merge(( map:entry('key1','myvalue1'), map:entry('key2','myvalue2'), map:entry('key','myvalue') ))"/>
</x:context>
<x:expectlabel="succeeds if map parameter uses map:merge">myvalue</x:expect>
</x:scenario>
<x:scenariolabel="Testing a named template with a map parameter">
<x:calltemplate="mytemplate">
<x:paramname="myparam"select="map{'key': 'myvalue'}"/>
</x:call>
<x:expectlabel="succeeds">myvalue</x:expect>
</x:scenario>
<!-- In the XSLT file that results from compiling this XSpec file, the parameter of the named template appears as <x:param name="myparam" select="map{{'key': 'myvalue'}}"/> while the parameter of the moded template appears as <x:param name="myparam" select="map{'key': 'myvalue'}"/> without doubling the curly braces.-->
</x:description>
XSLT code
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheetxmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:x="http://www.jenitennison.com/xslt/xspec"exclude-result-prefixes="xs"version="3.0">
<xsl:templatematch="myelement"mode="mymode">
<xsl:paramname="myparam"as="map(*)"/>
<!--<foo name="x" select="map{'a': 'b'}"/>--><!-- If uncommented, the line above has a validation error (Saxon-PE 9.8.0.8). -->
<xsl:value-ofselect="$myparam('key')"/>
</xsl:template>
<xsl:templatematch="myelement">
<xsl:paramname="myparam"as="map(*)"/>
<xsl:value-ofselect="$myparam('key')"/>
</xsl:template>
<xsl:templatename="mytemplate">
<xsl:paramname="myparam"as="map(*)"/>
<xsl:value-ofselect="$myparam('key')"/>
</xsl:template>
</xsl:stylesheet>
The text was updated successfully, but these errors were encountered:
Thanks, @galtm
I added a slightly modified set of files (bff83d3) to #444. The problem was reproduced: Travis, AppVeyor
Then I removed the test files from #444 and added them to #454. The problem was not reproduced: Travis
So the bug was fixed in #454. I updated #454 to include #538 explicitly.
<xsl:templatename="x:d6e4">
<xsl:message>Testing a moded template with a map parameter</xsl:message>
<x:scenario>
<x:label>Testing a moded template with a map parameter</x:label>
<x:contextmode="mymode">
<x:paramname="myparam"select="map{'key': 'myvalue'}"/>
<myelement/>
</x:context>
<xsl:templatename="x:d6e3">
<xsl:message>Testing a moded template with a map parameter</xsl:message>
<x:scenario>
<x:label>Testing a moded template with a map parameter</x:label>
<x:contextmode="mymode">
<x:param>
<xsl:attributename="name">myparam</xsl:attribute>
<xsl:attributename="select">map{'key': 'myvalue'}</xsl:attribute>
</x:param>
<myelement/>
</x:context>
<xsl:attribute name="select">map{'key': 'myvalue'}</xsl:attribute> is generated here.
If a scenario uses syntax like
then the compiled test is invalid. See sample code, below. The log includes these error messages:
From a quick look, I think the bug may be related to the
<xsl:template match="x:context | x:param" mode="x:report">
template incompiler/generate-xspec-tests.xsl
. I suspect that the<xsl:template match="@select" mode="x:report">
template does not get reached forx:param
insidex:context
.To reproduce problem:
XSpec code
XSLT code
The text was updated successfully, but these errors were encountered: