1
我有一個名爲entity
的根節點的XML文檔。對於每個文檔,我想要計算它的名稱爲tender
的節點數量,並將其作爲屬性添加到entity
。如何在Zorba XQuery中添加屬性?
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,這是不是左巴,但我猜,這是標準的XQuery。
我得到的錯誤
6,69: static error [err:XPST0003]: invalid expression: syntax error, unexpected expression (missing comma "," between expressions?)
我在做什麼錯?
讀是的,這會是正確的。 – wcandillon
下面是Zorba上的一個工作示例:http://try.zorba.io/queries/xquery/U%2FcxnnwOm8RG0mpsMI2hBikeIeQ%3D在這個示例中,我們使用xquery腳本來應用更新並返回結果。 – wcandillon