I am running below code and getting Conflicting updates error, I am running
this for each element, so on same doc but different node.
let $replace_config := fn:doc("/Config/replace_config.xml")
let $directory := $replace_config/adminfunctionality/directory/text()
return
<result>
{
for $replace in $replace_config/adminfunctionality/replace
let $replacenode := $replace/replacenode/xs:QName(string())
let $expression := $replace/expression/node()
let $oldvalue := $replace/oldvalue/node()
let $newvalue := $replace/newvalue/node()
(:This will return all URI of provided directory in config file:)
let $query:= cts:and-query((cts:directory-query($directory, "infinity"),()))
let $uris:=
for $uri in cts:uris((), (), $query)
where $uri eq
"/History/b1c73b37-77d8-11e0-bc44-859d080a1d50.xml" (: Please comment this
while doing for all documents :)
return $uri
let $eachelements:=
for $eachelement in
doc($uris)//*[node-name(.)=$replacenode]
where
fn:upper-case($eachelement/node()) eq fn:upper-case($expression)
return $eachelement
for $eachelement in $eachelements
return
<action>{$oldvalue} {$eachelement} { $newvalue}</action>
(:xdmp:node-replace($eachelement, $newvalue):)
}
</result>
~Gurbeer
XMl sample
________________________________
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or
views contained herein are not intended to be, and do not constitute, advice
within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and
Consumer Protection Act. If you have received this communication in error,
please destroy all electronic and paper copies and notify the sender
immediately. Mistransmission is not intended to waive confidentiality or
privilege. Morgan Stanley reserves the right, to the extent permitted under
applicable law, to monitor electronic communications. This message is subject
to terms available at the following link:
http://www.morganstanley.com/disclaimers If you cannot access these links,
please notify us by reply message and we will send the contents to you. By
messaging with Morgan Stanley you consent to the foregoing.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general