[xquery-talk] Manipulating Maps In Non-Trivial Ways

Eliot Kimber ekimber at contrext.com
Mon Jul 20 11:44:21 PDT 2015

Hmm, I'll have to think about that one.

In the context of XQuery I don't see how it's different from a FOR
expression inside map:merge(). In XSLT I can see the value because you
might be applying templates or something else you can't do directly in an
XPath expression.


Eliot Kimber, Owner
Contrext, LLC

On 7/20/15, 1:35 PM, "Michael Kay" <mike at saxonica.com> wrote:

>> On 19 Jul 2015, at 22:55, Eliot Kimber <ekimber at contrext.com> wrote:
>> Yes, the fold operations are still a bit too clever for my taste--I
>> to make my business a logic a little more verbose to clearer, at least
>> me--I don't want to have to think too deeply when I'm programming :-)
>Although I say it myself, I think the xsl:iterate instruction in XSLT
>3.0, which is essentially syntactic sugar over a fold operation,
>addresses the readability problem quite well:
>> $newKeys => fold-left($m1, function($key, $map) { $map => map:put($key,
>> ($map($key), $obj) })
><xsl:iterate select=³$newKeys²>
>  <xsl:param name=³map² select=³$m1²/>
>  <xsl:on-completion select=³$map²/>
>  <xsl:next-iteration>
>    <xsl:with-param name=³map² select=³map:put($map, ., ($map(.),
>  </xsl:next-iteration>
>Michael Kay

More information about the talk mailing list