[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: constructing arrays in XSLT with templates

Subject: Re: 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
Re:  constructing arrays in XSLT with templates
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.