Bug #5414
closedSaxon-JS 2.3 doesn't reject xsl:map-entry key="()"
100%
Description
Trying to understand what fails in https://saxonica.plan.io/issues/5384 I played around with xsl:map/xsl:map-entry
and Saxon-JS 2.3 and found that it doesn't identify an empty sequence as an error if used as the key
expression of an xsl:map-entry
, for instance, the test case
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
expand-text="yes">
<xsl:param name="map" as="map(xs:string, xs:integer)">
<xsl:map>
<xsl:map-entry key="()" select="4"/>
</xsl:map>
</xsl:param>
<xsl:template match="/" name="xsl:initial-template">
<root>test</root>
<xsl:comment>{serialize($map, map { 'method' : 'json', 'indent' : true() })}</xsl:comment>
<xsl:comment>Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</xsl:comment>
</xsl:template>
</xsl:stylesheet>
compiles fine with xslt3
:
xslt3 -t -nogo -xsl:empty-sequence-map-key-test1.xsl -export:empty-sequence-map-key-test1.sef.json
Saxon-JS 2.3 from Saxonica
Node.js version v14.16.0
Compiling stylesheet C:\SomePath\saxon-js-xsl-map-empty-key\empty-sequence-map-key-test1.xsl
Stylesheet compilation time: 0.33s
Stylesheet exported to SEF file C:\SomePath\saxon-js-xsl-map-empty-key\empty-sequence-map-key-test1.sef.json
but on running gives the error
<?xml version="1.0" encoding="UTF-8"?><root>test</root>Transformation failure: TypeError: Cannot read property 'hashCode' of null
Cannot read property 'hashCode' of null
It might, be, however, that the changes of https://saxonica.plan.io/issues/5230 fix this problem as well.
Updated by Michael Kay over 2 years ago
- Status changed from New to In Progress
Added XSLT3 test case maps-909; confirmed that XPTY0004 is reported by SaxonJ.
Updated by Michael Kay over 2 years ago
Confirmed that the current build of SaxonJS throws "Transformation failure: TypeError: Cannot read property 'hashCode' of null" on this test case. (This is running the test as compiled using XX).
Updated by Michael Kay over 2 years ago
- Category changed from XSLT Conformance to XX compiler
- Status changed from In Progress to Resolved
- Applies to JS Branch Trunk added
- Fix Committed on JS Branch 2, Trunk added
It turned out the patch in comment #7 of bug #5230 wasn't quite strong enough; it added atomisation for xsl:map-entry/@key
, but it didn't add a cardinality check. I've now achieved this by replacing the injected <data>
instruction with an <atomSing>
instruction which does a cardinality check (for a singleton) as well as atomisation.
Updated by Debbie Lockett over 2 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in JS Release set to SaxonJS 2.4
Bug fix applied in the SaxonJS 2.4 maintenance release.
Please register to edit this issue
Also available in: Atom PDF Tracking page