| '''Summary'''
| Creates a new ''map'' containing a single entry. The key of the entry in the new map is {{Code|$key}}, and its associated value is {{Code|$value}}. If the supplied key is {{Code|xs:untypedAtomic}}, it is compared as an instance of {{Code|xs:string}}. If the supplied key is the {{Code|xs:float}} or {{Code|xs:double}} value {{Code|NaN}}, the function returns the value in the entry whose key is {{Code|NaN}}, or the empty sequence otherwise.
The function {{Code|map:entry}} is intended primarily for use in conjunction with the function <code>[[#map:newmerge|map:newmerge]]</code>. For example, a map containing seven entries may be constructed like this:
<pre class="brush:xquery">
map:newmerge((
map:entry("Su", "Sunday"),
map:entry("Mo", "Monday"),
Unlike the <code>map{ ... }</code> expression, this technique can be used to construct a map with a variable number of entries, for example:
<pre class="brush:xquery">map:newmerge(for $b in //book return map:entry($b/isbn, $b))</pre>
|-
| '''Examples'''
|}
==map:newmerge== {{Mark|Added with Version 8.0}} (replacing {{Code|map:new}}):
{| width='100%'
| width='120' | '''Signatures'''
|{{Func|map:new||map(*)}}<br/>{{Func|map:newmerge|$inputs as map(*)*|map(*)}}
|-
| '''Summary'''
| Constructs and returns a new map. The zero-argument form of the function returns an empty ''map''. It is equivalent to calling the one-argument form of the function with an empty sequence as the value of the first argument.The one-argument form of the function returns a ''map'' that is formed by combining the contents of the maps supplied in the {{Code|$inputs}} argument. The supplied maps are combined as follows:
# There is one entry in the new map for each distinct key value present in the union of the input maps, where keys are considered distinct according to the rules of the {{Code|distinct-values}} function.
| '''Examples'''
|
* {{Code|map:new()}} creates an empty map.* {{Code|map:newmerge(())}} creates an empty map.* {{Code|map:newmerge((map:entry(0, "no"), map:entry(1, "yes")))}} creates <code>map { 0: "no", 1: "yes" }</code>.* <code>map:newmerge(($week, map{ 7: "Unbekannt" }))</code> creates <code>map { 0: "Sonntag", 1: "Montag", 2: "Dienstag", 3: "Mittwoch", 4: "Donnerstag", 5: "Freitag", 6: "Samstag", 7: "Unbekannt" }</code>.* <code>map:newmerge(($week, map{ 6: "Sonnabend" }))</code> creates <code>map { 0: "Sonntag", 1: "Montag", 2: "Dienstag", 3: "Mittwoch", 4: "Donnerstag", 5: "Freitag", 6: "Sonnabend" }</code>.
|}
| '''Examples'''
|
* {{Code|map:size(map:newmerge(()))}} returns {{Code|0}}.
* <code>map:size(map{ "true": 1, "false": 0 })</code> returns {{Code|2}}.
|}
* Introduction on maps moved to [[XQuery 3.1#Maps|XQuery 3.1]].
* Removed: support for collations (in accordance with the XQuery 3.1 spec).
* Removed: {{Code|map:new}} (replaced with {{Code|map:merge}})
* Updated: aligned with latest specification: compare keys of type {{Code|xs:untypedAtomic}} as {{Code|xs:string}} instances, store {{Code|xs:float}} or {{Code|xs:double}} value {{Code|NaN}}.