Many thanks!
Is working correctly now.
Corrected code:
xquery version "1.0";
module namespace m="http://www.host.ru/xquery/m";
declare variable $m:db := "mydb";
declare updating function m:up() {
let $new-doc := <root-element><item>1</item></root-element>
return
db:add($m:db, document { $new-doc }, "id1.xml")
};
Andreas Weiler писал 2012-02-08 11:24:
Hi there,i guess you have to define the function as updating [1].-- AndreasAm 08.02.2012 um 06:29 schrieb andy:
_______________________________________________Hi!
If there is a module:
xquery version "1.0";
module namespace m="http://www.host.ru/xquery/m";
declare variable $m:db := "mydb";
declare function m:up() as xs:string {
let $new-doc := 1
let $update := db:add($m:db, document { $new-doc }, "id1.xml")
return
"Result string"
};
and I use it from python API or basexclient utility. Use as:
xquery import module namespace m="http://www.host.ru/xquery/m" at "/tmp/test.xqy"; m:up()
I get an error:
Stopped at line 8, column 4 in /tmp/test.xqy:
[XUST0001] Let expression: no updating expression allowed.
What could be the problem?--
Regards, Andrey Ganyushkin
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Regards,
Andrey Ganyushkin