Actions
Bug #1903
closedsaxon:key-map appears to default to open-ended "max" value when no keys satisfy given range.
Start date:
2013-09-17
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Description
Scenario:
$key is a key enabled with saxon:range-key="true", and $key has no entries in the range $min to $max for document $doc
Expected behavior: saxon:key-map($key, $doc, $min, $max) returns an empty map.
Actual behavior: saxon:key-map($key, $doc, $min, $max) returns all entries whose key values are above $min.
Reproducible: The following script, when processed by Saxon 9.5.0.2 returns the output
1 2
9
The "9" is unexpected. I searched saxonica.plan.io for tickets associated to saxon:key-map() and did not find any, so I assumed this has not been resolved.
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:saxon="http://saxon.sf.net/"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
>
<xsl:key name="key" match="cars/car" use="@id" saxon:range-key="yes"/>
<xsl:variable name="car.doc">
<cars>
<car id="1"/>
<car id="2"/>
<car id="3"/>
<car id="9"/>
</cars>
</xsl:variable>
<xsl:variable name="seq" select="0,1,2,3,4,5"/>
<xsl:template match="/">
<xsl:text>
</xsl:text>
<xsl:variable name="map1" select="saxon:key-map('key',$
car.doc,'0','2')"/>
<xsl:value-of select="map:keys($map1)"/>
<xsl:text>
</xsl:text>
<xsl:variable name="map2" select="saxon:key-map('key',$car.doc,'5','8')"/>
<xsl:value-of select="map:keys($map2)"/>
</xsl:template>
</xsl:stylesheet>
Files
Please register to edit this issue
Actions