[xquery-talk] how to remove repetition using distinct value of strings

fatma helmy fatmahelmy2000 at yahoo.com
Fri Mar 3 10:21:12 PST 2006


i have this code
let $j:=
<bookstore>
<book>
   <author firstname='joe' lastname='carlon' >
</author> 
</book>
<book>
   <author firstname='joe' lastname='carlon' >
</author> 
</book>
<book>
   <author firstname='mary' > </author> 
</book>

</bookstore>
 for $attr in  $j//author//@* 
 let $n:= name($attr) 
  
return

(
   for $v in distinct-values($j//@*[name()=$n])
return
 (
<attr>  name="{$n}" 
 val="{$v}" 
  count = "{count ($j//@*[name()= $n ] [.=$v])}"    
</attr> 

 ) 
 
 
 )

this code works but i have repetition, i need to get
distinct names of attribute list



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the talk mailing list