let $full-dataset := <root-node>
<dataset>
    <title>test</title>
    <name xml:lang="fr">testName-fr</name>
    <name xml:lang="en">testName-en</name>
  </dataset>
  <dataset>
    <descText xml:lang="fr">descText-fr</descText>
  </dataset>
</root-node>
return $full-dataset//@xml:lang/..

Essentially: Use XPath to find the particular attribute you're interested in 
wherever it is, and then return its parent.



From: [email protected] 
[mailto:[email protected]] On Behalf Of sini narayanan
Sent: Saturday, June 29, 2013 11:24 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] get node values based on filter condition

Hi All,
How do I retrieve the node values of all the nodes that have the attribute 
named xml:lang?
xml sample:
<root-node>
  <dataset>
    <title>test</title>
    <name xml:lang="fr">testName-fr</name>
    <name xml:lang="en">testName-en</name>
  </dataset>
  <dataset>
    <descText xml:lang="fr">descText-fr</descText>
  </dataset>
</root-node>
for the above example, how do I get only the node values that have xml:lang 
attributes?
Thanks,
Sini
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to