map:merge
Creates a new map that combines entries from a number of existing maps. There is one
entry in the new map for each distinct key present in the union of the input maps; the way
duplicate keys are handled is determined by the supplied $options.
WARNING: Since 9.7.0.8, the changes in the W3C Specification introduce a significant change to the default behaviour of the function when there are duplicate keys. Previously (up to and including 9.7.0.7), the associated value for each key in the new map was taken from the last map in the input sequence containing that key. From 9.7.0.8, the default behaviour is to take the value from the first map containing that key.
merge($maps as map(*)*, $options as map(*)?:={}) ➔ map(*)
Arguments | ||||
| $maps | map(*)* | The input maps | |
| $options | map(*)? | := {} | Used to control the way in which merging takes place |
Result | map(*) | |||
Namespace
http://www.w3.org/2005/xpath-functions/map
Links to W3C specifications
XPath 3.1 Functions and Operators
XPath 4.0 Functions and Operators
Saxon availability
Available in XPath 3.1, XSLT 3.0, XQuery 3.1, and later versions. From Saxon 9.7, available in all editions. Available for all platforms.
Notes on the Saxon implementation
From Saxon 10 thru 12, several vendor-defined options were recognized: saxon:on-duplicates,
saxon:key-type, saxon:final. In Saxon 13, only the options
defined in the QT4.0 specification are recognized: specifically, the duplicates option.