Hi ,

We need to update huge amount of XML/xhtml  and it's a production  data.

Let me explain you process

We have a submission form, through which we submit document to Marklogic, 
Submission form contains Meta data. There is structural change in Submission 
form meta data. We need to update these meta data of all documents in ML
One way is design a JOB which will resubmit all these documents with new meta 
data ..but it's a long process

I tried below query in CQ  for one document and it worked, just want to know, 
is it safe to play like this


xquery version "1.0-ml";

import module namespace 
config="http://www.makrlogic.com/morganStanley/delivery/ui/lib/searchConfig.xqy";
 at "/lib/searchConfig.xqy";
import module namespace search="http://marklogic.com/appservices/search"; at 
"/MarkLogic/appservices/search/search.xqy";
declare namespace fwp="http://morganstanley.com/firmwidePolicy";;
declare namespace xhtml="http://www.w3.org/1999/xhtml";;

declare  variable $TAXONOMY_DOC :="/topicMaps/CCid.xml";

let $query:=
cts:and-query((cts:directory-query("/policies/", "infinity"),
cts:element-value-query(xs:QName("fwp:ccid"),"1N41")))

let 
$newnode:=fn:doc($TAXONOMY_DOC)/firmwidePolicy/CCid[@code="1N41"]/fwp:divisions

for $uri in cts:uris((), (), $query) where $uri eq 
"/policies/otherDocs/1549333_doc.xhtml" (: we will not use where clause :)

return
xdmp:node-replace(fn:doc($uri)/xhtml:html/xhtml:head/fwp:divisions,$newnode)


~Gurbeer

--------------------------------------------------------------------------
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

Reply via email to