Project

Profile

Help

Bug #5414

closed

Saxon-JS 2.3 doesn't reject xsl:map-entry key="()"

Added by Martin Honnen about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
XX compiler
Sprint/Milestone:
Start date:
2022-03-23
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
2, Trunk
Fix Committed on JS Branch:
2, Trunk
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

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.

Please register to edit this issue

Also available in: Atom PDF Tracking page