xsl-list
[Top] [All Lists]

Re: [xsl] constructing arrays in XSLT with templates

2021-06-19 05:47:37

Am 19.06.2021 um 12:37 schrieb Martin Honnen 
martin(_dot_)honnen(_at_)gmx(_dot_)de:

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/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>