Loading TOC...

map:with

map:with(
   $map as map:map,
   $key as xs:string,
   $value as item()*
) as map:map

Summary

Updates a map, inserting a value into it at the given key. The map is returned as the result.

Parameters
$map A map.
$key A key. If the key is not unique, it will overwrite the existing key.
$value A value. If the value is the empty sequence, it will remove the key from the map.

Example

let $map := map:map()
  =>map:with("some-key",<info>45683</info>)
return
<result>{$map}</result>

=>
<result>
  <map:map xmlns:map="http://marklogic.com/xdmp/map"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <map:entry key="some-key">
      <map:value>
        <info>45683</info>
      </map:value>
    </map:entry>
  </map:map>
</result>

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.