Hi,
How do I rename all the "record" nodes in a database? I'm trying:
for $x in db:open("bccdc_covid19")
return return rename node $x//record as "baz"
but this gives back
Stopped at ., 1/13: [XPDY0002] bc.rename.xq: no context value bound.
or
[XPST0003] Unexpected end of query: 'rename node $x/...'.
depending whether it's run from within the basex console.
thanks,
Nick
Pardon, this indeed works:
for $x in db:open("bccdc_covid19")
return rename node $x//baz as "foo"
but only for the first node baz -- how can I rename all of the nodes? Or match an Xpath?
It's CSV data, so the general layout (?) is csv/record/entry and instead of "record" I'd want that to be something else -- doesn't really matter what.
Hi Nick,
for $x in db:open("bccdc_covid19") return rename node $x//baz as "foo"
The rename expression must be performed on a single target node. Try this instead:
for $baz in db:open("bccdc_covid19")//baz return rename node $baz as "foo"
…or…
db:open("bccdc_covid19")//baz ! (rename node . as "foo")
Hope this helps, Christian
On Fri, Jun 19, 2020 at 12:22 AM Nicholas saunders.nicholas@gmail.com wrote:
Pardon, this indeed works:
for $x in db:open("bccdc_covid19") return rename node $x//baz as "foo"
but only for the first node baz -- how can I rename all of the nodes? Or match an Xpath?
It's CSV data, so the general layout (?) is csv/record/entry and instead of "record" I'd want that to be something else -- doesn't really matter what.
basex-talk@mailman.uni-konstanz.de