Iterating over maps and arrays
The three instructions xsl:for-each,
xsl:iterate, and
xsl:for-each-group
can take an attribute array or map in place of
the select attribute.
If array is specified, the instruction iterates over the selected array. Specifically, the
body of the instruction is evaluated with the context item being a parcel containing the items making
up the corresponding member of the array; these items may be extracted with the fn:unparcel()
function, or simply with the lookup expression ?value. For example:
outputs 1 3 11 2.
If map is specified, the instruction iterates over the selected map. Specifically, the
body of the instruction is evaluated with the context item being a map containing two entries:
an entry named "key" holding the key, and an entry named "value" holding the corresponding value.
The order of entries is undefined (but <xsl:sort select="?key"/> can be used to sort them).