Hi Chas,
a nice simplification would be to use XPath instead of full-blown FLWORs for your simple selections:
Am 16.08.2010 11:41, schrieb chas@munat.com:
chas = new XQuery(""" for $x in /forum/users/User where $x/username="Chas" return $x """).execute(context)
could then be rewritten as chas = new XQuery("/forum/users/User[username='Chas']").execute(context)
This can also be applied to the other queries:
Am 16.08.2010 12:00, schrieb Andreas Weiler:
for $x in /forum/users/User where $x/username="Chas" return replace value of node $x/username with " + chas
replace value of node /forum/users/User/username[text() = 'Chas'] with 'Charles'
(This only works if the username is unique and thus the XPath expression yields a single node.)
Then this one should work:
for $x in /forum/users/User where $x/password="secret" return delete nodes $x
delete nodes /forum/users/User[password='secret']
XQuery is still needed if you want to transform the results in the query.
Hope this helps, Cheers Leo