Dear Danny, indeed I know how to do that. Dear Christophe and Michael, indeed I need to get rid of the space. Thanks for pointing the obvious out to me.
Apparently, however, this is not an issue in Danny's solution. Hence, I will go for Danny's solution. Thanks, Frank -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Danny Sokolsky Sent: 08 December 2014 19:48 To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output You already know how to do that. Just do something like this (passing a sequence into a word-query treats each item as an or): let $s := (fn:tokenize("auto, kind", ",")) let $doc := <a> <b id="car"> <c xml:lang="en">car</c> <c xml:lang="nl">auto</c> <c xml:lang="fr">voiture</c> </b> <b id="house"> <c xml:lang="en">house</c> <c xml:lang="nl">huis</c> <c xml:lang="fr">maison</c> </b> <b id= "child"> <c xml:lang="en">child</c> <c xml:lang="nl">kind</c> <c xml:lang="fr">enfant</c> </b> </a> return $doc//c[cts:contains(., cts:word-query($s, "lang=nl") )] -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Frank Mortier Sent: Monday, December 08, 2014 10:38 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output Thanks Danny, I need to get from the string ('auto, kind') to ('auto', 'kind'). Chris, it should return 'car' and 'child'. Tim, does not work, returns only the first id 'car' Rob, same answer as for Danny. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Danny Sokolsky Sent: 08 December 2014 19:15 To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output Hi Frank, Or how about if you do a language-sensitive search. For example: let $doc := <a> <b id="car"> <c xml:lang="en">car</c> <c xml:lang="nl">auto</c> <c xml:lang="fr">voiture</c> </b> <b id="house"> <c xml:lang="en">house</c> <c xml:lang="nl">huis</c> <c xml:lang="fr">maison</c> </b> <b id= "child"> <c xml:lang="en">child</c> <c xml:lang="nl">kind</c> <c xml:lang="fr">enfant</c> </b> </a> return $doc//c[cts:contains(., cts:or-query(( cts:word-query("auto", "lang=nl"), cts:word-query("kind", "lang=nl"))) )] => <c xml:lang="nl">auto</c> <c xml:lang="nl">kind</c> -Danny -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Christopher Hamlin Sent: Monday, December 08, 2014 10:14 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output Hi Frank, Not exactly sure if it's what you want, but maybe helps you get closer: for $x in $doc/b/c[@xml:lang eq"nl"] where $x/fn:string() = fn:tokenize('auto, kind', ',') return $x/../@id/fn:string() returns 'car'. I changed it so it compares the string value of $x with a list of strings from tokenize. Note that I'm using = instead of eq. That lets you use a sequence compare. Also the return now returns the @id attribute node. - Chris _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
