Hi Zise,
There are various ways to do this simple task. Find the below sample code :
let $doc := fn:doc("/xmlFile.xml")let $oldNode :=
$doc/catalog/product/name[@language="en"]let $newNode := element
{fn:local-name($oldNode)} { attribute language {"chinese"}, $oldNode/text()}
return xdmp:node-replace($oldNode,$newNode)
Above code will work as expected. But, if your database size is very huge and
you want to perform such update on entire database then use cts:queries for
better performance.
Regards,Asit Nautiyal
Date: Wed, 1 Jul 2015 11:50:02 +0800
From: [email protected]
To: [email protected]
Subject: [MarkLogic Dev General] how to update the attribute of nodes?
the xml document is:<catalog><product dept="ACC"><number>443</number><name
language="en">Deluxe Travel Bag</name></product></catalog>
I want to update the attirbute language of node name to new value, after
update operation, the name node is:<name language="chinese">Deluxe Travel
Bag</name>
which function can do this in marklogic 8.0?
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general