zorba

Zorba "context item" undeclared variable error


I downloaded the file called standard and renamed it as auction.xml from the following website Link to file

I wrote an insert query and stored in a file called insertqz.xq

for $doc in doc('auction.xml')/site/open_auctions//bidder/increase
return insert node <watch open_auction='open_auction5104'/> before $doc

and run the following command : zorba -t -q insertqz.xq

I get the following error: (no URI):1,2: dynamic error [err:XPDY0002]: "context item": undeclared variable

Can someone help me out?


Solution

  • remove -q

    zorba -t insertqz.xq

    to print the updated xml file:

    for $doc in doc("auction.xml")/site/open_auctions//bidder/increase return insert node <watch open_auction="open_auction5104"/> before $doc; doc("auction.xml")