我有一个名为entity的根节点的XML文档。对于每个文档,我想数一数它有多少个名为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我跟踪的是ext.xml,这不是给Zorba的,但我猜这是标准XQuery。
我知道错误了
6,69: static error [err:XPST0003]: invalid expression: syntax error, unexpected expression (missing comma "," between expressions?)我做错了什么?
发布于 2014-03-06 11:31:18
我怀疑您的update语句对Zorba不正确。eXist实现了XQuery更新1.0的早期草案。相反,我认为Zorba正确地实现了XQuery更新1.0规范,因此您的更新应该符合以下内容:http://www.w3.org/TR/xquery-update-10/
也许是这样的:
for $file in file:list("../api/entity/p/", true(), "??????.xml")
let $doc := doc(concat("../api/entity/p/", $file))
return
insert node attribute number_of_tenders {count($doc//tender)} into $doc/entity尤其是读一下http://www.w3.org/TR/xquery-update-10/#id-insert
https://stackoverflow.com/questions/22221919
复制相似问题