XSLT: keys as maps #1619
Labels
Feature
A change that introduces a new feature
Tests Needed
Tests need to be written or merged
XSLT
An issue related to XSLT
I propose an XSLT function map-for-key('keyname', $root) which returns a map $M having the property that
map:get($M, $key)
returns the value ofkey('keyname', $key, $root)
.This enables XSLT keys to be exploited in new ways: for example it becomes easy to merge the indexes for multiple documents, or to iterate over all the keys in a document.
These benefits can already be obtained by scrapping keys entirely and building maps instead; but keys do have some benefits (like remaining implicitly associated with particular documents, and being "more declarative") and if you've got a legacy application that makes extensive use of keys, this function gives you a bridging capability.
There are a few edge cases that will need ironing out, for example keys allow matching using a collation, which maps don't. (And the spec of xsl:key, now I come to think of it, says nothing about comparing date/time values in different timezones; I don't expect anyone has ever tried.)
The text was updated successfully, but these errors were encountered: