The suggestion
return $full-dataset//@xml:lang/..
Returns the entire node not the node values
To get the values (say as a string() add /string()
return $full-dataset//@xml:lang/../string()
Another equally valid way is using predicates
return $full-dataset//node()[@xml:lang]/string()
-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]
Phone: +1 812-482-5224
Cell: +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>
From: [email protected]
[mailto:[email protected]] On Behalf Of Lee, Bruce (CGI
Federal)
Sent: Saturday, June 29, 2013 12:25 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] get node values based on filter condition
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