0
我弄不明白有点琐碎的事情!XQuery - 传递参数列表
我需要自动化TEI XML的ePub包装。我知道如何使用compression
,但不能通过编程方式传递参数列表。问题是我想从一组divs
中获取一个列表,并将它作为参数传递给该函数。
而不是
let $entries := (<entry>x</entry>, <entry>y</entry>)
compression:zip($entries, true())
我需要做的是这样
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())
我根本无法通过提取divs
为逗号分隔的参数列表(如压缩需求)。如果我可以使用类似数组迭代或路径连接的东西,那就好了!
我很亲近
for $chapter at $count in doc('./bukwor.xml')//tei:div[@n='1']
return
<entry name="chapter-{$count}"> type="xml">{$chapter}</entry>
,但仍无法做到的魔力。
在XQuery中,所谓的“逗号分隔参数列表”被称为“序列”。函数可以将序列作为参数。要确切了解任何特定功能,可以查阅eXist的功能文档;对于'compression:zip()'来说,文档位于http://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/compression&location= Java的:org.exist.xquery.modules.compression.CompressionModule#zip.2。请注意,'$ sources'参数必须是**一个或多个** xs:anyType类型的项目(足够广泛,可以包含数据库URI或'元素。) –
joewiz
并找出解决方法! eXist中的epubs压缩工作很好,一旦你得到它的工作。您可以在https://github.com/wolfgangmm/tei-simple-pm/blob/master/modules/epub.xql找到更多示例代码。 – joewiz
谢谢,是的,链接是灵感的源泉! –