[Bug 19158] Getting all vales from a map

https://www.w3.org/Bugs/Public/show_bug.cgi?id=19158

--- Comment #4 from Michael Kay <mike@saxonica.com> 2012-10-08 22:30:43 UTC ---
I think the idea of a map:process() calling a user-supplied function with two
arguments - key and value - makes good sense; effectively a mapping function
applied to the entries in a map. I can't see a good use case for a "fold" (or
accumulator) capability here, since the order of processing would be undefined,
and aggregation across the entries in a map isn't an especially common use
case.

The flattened set of values could be achieved simply with

map:process($map, function($k, $v){$v})

Conversion to an element structure would look like this:

<xsl:function name="f:pair">
  <xsl:param name="key"/>
  <xsl:param name="value"/>
  <pair key="{$key}" value="{$value}"/>
</xsl:function>

map:process($map, f:pair#2)

Feels good.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 8 October 2012 22:30:44 UTC