我有 XML 文档,其根节点名为entity
. 对于每个文档,我想用名称计算它有多少个节点tender
,并将其作为属性添加到entity
.
import module namespace file = "http://expath.org/ns/file";
for $file in file:list("../api/entity/p/", true(), "??????.xml")
let $doc := doc(concat("../api/entity/p/", $file))
return
update insert attribute number_of_tenders {count($doc//tender)} into $doc/entity
我关注的是http://exist-db.org/exist/apps/doc/update_ext.xml,这不适合 Zorba,但我猜这是标准的 XQuery。
我得到错误
6,69: static error [err:XPST0003]: invalid expression: syntax error, unexpected expression (missing comma "," between expressions?)
我究竟做错了什么?