Re: [xsl] constructing arrays in XSLT with templates

Subject: Re: [xsl] constructing arrays in XSLT with templates
From: "Alan Painter alan.painter@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 19 Jun 2021 13:49:58 -0000
I like the binding via the *for $book in books/book* expression .. it makes
the entire mapping block more readable.

Thanks again, very helpful.

-alan




On Sat, Jun 19, 2021 at 12:47 PM Martin Honnen martin.honnen@xxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>
> Am 19.06.2021 um 12:37 schrieb Martin Honnen martin.honnen@xxxxxx:
>
> Or you would need to use a for expression to bind a "book" e.g.
>
>
>     map {
>       'books' : array {
>         for $book in books/book return map:merge((
>           map:entry('title',        $book!title         !string()   ),
>           map:entry('authors',      array { $book!author!string() } ),
> *          map:entry('out-of-print', true())[$book/@out-of-print eq
> 'true']*
>         ))
>       }
>     }
>
>
> Or perhaps a local let binding
>
>
>     map {
>       'books' : array {
>         books/book ! map:merge((
>           map:entry('title',        title         !string()   ),
>           map:entry('authors',      array { author!string() } ),
>           let $book := . return map:entry('out-of-print',
> true())[$book/@out-of-print eq 'true']
>         ))
>       }
>     }
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/552232> (by
> email <>)

Current Thread