xml - How to add an attribute in a Zorba XQuery? -


i have xml documents root node called entity. each document, want count how many nodes has name tender , add attribute entity.

import module namespace file = "http://expath.org/ns/file";  $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)} $doc/entity 

i following http://exist-db.org/exist/apps/doc/update_ext.xml, not zorba, guessed standard xquery.

i error

6,69: static error [err:xpst0003]: invalid expression: syntax error, unexpected expression (missing comma "," between expressions?) 

what doing wrong?

i suspect update statement not correct zorba. exist implements draft of xquery update 1.0. believe instead zorba correctly implemenets xquery update 1.0 specification, update should conform instead: http://www.w3.org/tr/xquery-update-10/

perhaps like:

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)} $doc/entity 

in particular have read of http://www.w3.org/tr/xquery-update-10/#id-insert


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -