How about this?

$doc/b[c eq ("kind", "auto") and c/@xml:lang eq "nl"]/@id/fn:string()


From: Frank Mortier <[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Monday, 8 December 2014 18:01
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Given the following doc:

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

And the following string  (‘kind,  car’),  and language code (‘nl’), I would 
like to retrieve the id attribute values.

I am looking for a simple flowr but do not seem to understand why the following 
is not working.

     for $x in $doc/b/c[@xml:lang eq"nl"]
     where $x eq fn:tokenize('auto, kind', ',')
     return
     $x/../@value

Only gives the ‘id‘ whereas (‘auto’, ‘kind’) as in $x eq (‘auto’, ‘kind’) works?

Any suggestions would be welcome.

Frank
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to