Changes

Jump to navigation Jump to search
103 bytes removed ,  17:24, 16 January 2019
This [[Module Library|XQuery Module]] contains functions for manipulating maps, which has . Maps have been introduced with [[XQuery 3.1and are described in detail in the [https://www.w3.org/TR/xpath-functions-31/#Maps|maps-and-arrays XQuery Functions and Operators 3.1]specification].
=Conventions=
==map:find==
 
{{Mark|Introduced with Version 8.6:}}
{| width='100%'
{| width='100%'
| width='120' | '''Signatures'''
|{{Func|map:for-each|$map as map(*), $fun function as function(xs:anyAtomicType, item()*) as item()*|item()*}}
|-
| '''Summary'''
|Applies a the specified {{Code|$function }} to every entry key/value pair of the supplied {{Code|$map}} and returns the results as a sequence. The function supplied as {{Code|$fun}} takes two arguments. It is called supplying the key of the map entry as the first argument, and the associated value as the second argument.
|-
| '''Examples'''
map:for-each(
map { 1: 2, 3: 4 },
function($akey, $bvalue) { $a key + $b value }
)
</pre>
==map:merge==
 
{{Mark|Updated with Version 8.6:}} Signature extended with options argument. By default, value of first key is now adopted.
{| width='100%'
| Constructs and returns a new map. The ''map'' is formed by combining the contents of the supplied {{Code|$maps}}. The maps are combined as follows:
# There is one entry in the new map for each distinct key present in the union of the input maps.
# The {{Code|$options}} argument defines how duplicate keys are handled. Currently, a single option {{Code|duplicates}} exists, and its allowed values are {{Code|use-first}}, {{Code|use-last}}, {{Code|use-combine}} and {{Code|reject}}(default: {{Code|use-first}}).
|-
| '''Examples'''
;Version 8.6
* Added: [[#map:find|map:find]]
* Updated: [[#map:merge|map:merge]]: Signature extended with options argument. By default, value of first key is now adopted(instead of last, as in previous versions).
;Version 8.4
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu