MENU
Map Functions
Maps are collections of key/value entries, written with curly braces (e.g. {"a":1,"b":2}); like arrays, they were introduced in XPath 3.1. The map: functions below are evaluated against:| let $m := {"a":1,"b":2,3:"c"} return … |
| map:get($m,3) | c |
| map:contains($m,"b") | true |
| map:keys($m) | a b 3 |
| map:size($m) | 3 |
| map:put($m,4,"d") | {"a": 1, "b": 2, "3": "c", "4": "d"} |
| map:remove($m,"a") | {"b": 2, "3": "c"} |
| map:merge((map:entry("a",100), map:entry("b",200))) | {"a": 100, "b": 200} |
| map:find([$m,$m],"a") | [1, 1] |
| map:for-each($m, function($k,$v){$k||$v}) | a1 b2 3c |
ch03-map-functions.xpath.txt:
let $m := {"a":1,"b":2,3:"c"}
return map:get($m,3)c