map:for-each
Processes every key/value pair in a map by applying the given function, returning the results as a sequence in entry order.
for-each($map as map(*), $action as fn($key as xs:anyAtomicType, $value as item()*, $position as xs:integer) as item()*) ➔ item()*
Arguments | ||||
| $map | map(*) | The input map | |
| $action | fn($key as xs:anyAtomicType, $value as item()*, $position as xs:integer) as item()* | The function to be applied | |
Result | item()* | |||
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 10, available in all editions. Implemented in Saxon-PE and Saxon-EE since Saxon 9.6. Available for all platforms.
Notes on the Saxon implementation
Available in Saxon-HE from Saxon 10; in Saxon-PE/EE since 9.6.
Available as defined in XSLT 3.0 since Saxon 9.6, replacing the previously available
function map:for-each-entry (which was available since Saxon 9.4). Available
in XSLT, XPath, and XQuery, whether or not 3.0 is available.
XPath 3.1 version implemented since Saxon 9.7.
From XPath 4.0, the entries in a map are ordered (previously order was not significant). Since Saxon 13.0, map order is preserved whether or not XPath 4.0 features are enabled, so this function always now returns the results in entry order.