I can’t figure out a bit trivial thing!
I need to automatize packing of ePubs from TEI XML. I know how to use compression
but can’t pass list of arguments programmatically. The problem is I want to take a list made from a set of divs
and pass it to the function as arguments.
Instead of
let $entries := (<entry>x</entry>, <entry>y</entry>)
compression:zip($entries, true())
I need to do something like
let $header := (<header>xyz</header>)
let $divs := (
for $book in doc('./file.xml')
return $book//tei:div[@n='1']
)
let $entries := (
for $div in $divs
return <entry>{$div}</entry>
)
compression:zip($entries, $header, true())
I simply can’t pass extracted divs
as a comma-separated list of arguments (as the compressing needs). If I could use something like array iteration or path joining, it would be fine!
I am very close with
for $chapter at $count in doc('./bukwor.xml')//tei:div[@n='1']
return
<entry name="chapter-{$count}"> type="xml">{$chapter}</entry>
but still can’t do the magic.