Dear Niels,
Welcome on the list!
On Mon, Feb 2, 2015 at 2:42 PM, Niels Grundtvig Nielsen communicator.ngn@gmail.com wrote:
BaseX already looks/feels like a program I am going to enjoy using, even with the general challenge that I don't know enough about xQuery. I would welcome suggestions for anywhere to find a friendly introduction!
You could start having a look at [1] or [2].
My first specific challenge is trying to under the syntax for replace. [...]
//score[contains(title, '35. Andan')]//title replace value of (title) with '35. Andantino'
The following query should do what you want:
for $title in //score[contains(title, '35. Andan')]//title return replace value of node $title with '35. Andantino'
Here is yet another alternative:
for $title in //score/title[contains(., '35. Andan')] return replace value of node $title with '35. Andantino'
Feel free to check out our Wiki article on updates [3].
Hope this helps, Christian
[1] http://www.w3schools.com/xquery/ [2] http://docs.basex.org/wiki/XQuery [3] http://docs.basex.org/wiki/Updates
My first specific challenge is trying to under the syntax for replace. In the code, I've managed to retrieve a single xml document where <title> contains "35. Andan" … I made a copy/paste error, and in this document the value of title should be '35. Andantino' instead of '35. Andantino mesto'. My experiment is obviously incorrect, so I'd welcome tips on what's wrong with it.
//score[contains(title, '35. Andan')]//title replace value of (title) with '35. Andantino'
Thanks in advance!