map:find() - initial sketch proposal

Here's an first stab at a proposal for a map:find() function in response to bug 29743.

     map:find($x as item()*, $key as xs:anyAtomicType) as array(*)

This function returns an array containing all values that are associated with the key $key in any map that is *contained in* the value of $x

A map or array M is *contained in* a sequence S if any of the following conditions holds:

* M is an item in the sequence S (including the case where S is the single item M)

* M is *contained in* the value part of a key-value pair within a map that is itself *contained in* S

* M is *contained in* a member of an array that is itself *contained in* S

The order of members in the result array is implementation-dependent.

If nothing is found (including the case where $x is an empty sequence), the function returns an empty array.

Michael Kay
Saxonica

Received on Tuesday, 26 July 2016 16:49:16 UTC