This is somewhat related to this MySQL to update an XML attribute but this time I want to update the node value. I have the following XMLfragment which is in marcxml column:
<leader>00227nz a2200109n 4500</leader>
<controlfield tag="001">1</controlfield>
...
<controlfield tag="005">20091210091717.0</controlfield>
...
I want to update the controlfield value tag 001 such that it becomes a number based on a query. So like this:
<leader>00227nz a2200109n 4500</leader>
<controlfield tag="001">10</controlfield>
...
<controlfield tag="005">20091210091717.0</controlfield>
...
I have initially the following mysql query:
UPDATE auth_header SET marcxml = UpdateXML(marcxml, '//controlfield[@tag="001"]', CONCAT('<controlfield tag="001">', '10', '</controlfield>')) WHERE Extractvalue(marcxml, '//controlfield[@tag="001"]') ='169625';
The table is auth_header and it has authid as primary key (but I guess this does no matter) and it has marcxml column where the xml is stored. The query gives me '0 rows affected.' so it seems it does not work.
Thanks in advance and cheers!