[xquery-talk] Returning dublicates

Howard Katz howardk at fatdog.com
Sat Jun 18 10:14:04 PDT 2005


I was looking for a query that would work "without rebuilding the document
from scratch". Mike has to rebuild the document *somewhat* (he still needs
to supply an outer <A> wrapper), but he doesn't have to do so from scratch.
Is that a winner? I'm not sure. 
 
What I'll do however (no question about it) is award him a copy of the book
for elegance and concision. Lovely!
 
If he doesn't mind, I'm going to see what the book is currently remaindering
for and make an equivalent PayPal donation to his sourceforge account. I'm
sure the money will be useful.
Howard


  _____  

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


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/07be9a20/attachment.htm


More information about the talk mailing list