[xquery-talk] Returning dublicates

Michael Kay mhk at mhk.me.uk
Sat Jun 18 14:16:56 PDT 2005


Or more concisely
 
for $i in distinct-values(A/B) 
return A/B[. = $i][2]
 
Michael Kay
http://www.saxonica.com/


  _____  

From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On Behalf Of
Michael Kay
Sent: 18 June 2005 12:56
To: 'EXTERNAL Kruse Peter (Praktikant;CR/AEF4)'; talk at xquery.com
Subject: RE: [xquery-talk] Returning dublicates 


for $i in distinct-values(A/B) 
where exists (A/B[. = $i][2]) 
return A/B[. = $i][1]
 
 
Michael Kay
http://www.saxonica.com/
 
 


  _____  

From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On Behalf Of
EXTERNAL Kruse Peter (Praktikant;CR/AEF4)
Sent: 17 June 2005 14:46
To: talk at xquery.com
Subject: [xquery-talk] Returning dublicates 



Hi list, 
You are always a very big help for me, so i feel free to ask more questions.


I have an XML tree (of course) and want to find those nodes with certain
properties, which exists twice (or more). 

So i have 
<A> 
        <B>mary</B> 
        <B>tom</B> 
        <B>bob</B> 
        <B>mary</B> 
        <B>bob</B> 
</A> 

And i'd like to have a result like 
<A> 
        <B>mary</B> 
        <B>bob</B> 
</A> 

Note: <B>tom</B> is not included in the result, because there is only one
occurance of <B>tom</B> 

Thank you all for your patients and have a nice weekend 

Mit freundlichen Grüßen, Best Regards 
        Peter 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xquery.com/pipermail/talk/attachments/20050618/c062bc33/attachment-0001.htm


More information about the talk mailing list