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

Reply via email to