[xquery-talk] attribute names and their distinct values

fatma helmy fatmahelmy2000 at yahoo.com
Thu May 25 01:03:31 PDT 2006

regarding my xquery
declare function local:pathOfNode($node) 
{if(empty($node/..)) then "" else
concat(local:pathOfNode($node/..), "/",
let $j:= doc("try.XML") 

let $paths := for $n in $j//* return

for $p in distinct-values($paths) 
let $papa:= replace($p,'/[^/]*$','') 
let $leafs :=$j//text()[normalize-space()]
eq substring-after(string($p),"/") ] 

{string( round( count($paths[.=$p]) div
count($paths[.=$papa]) * 100 ) )} 
{for $val in  distinct-values( $leafs) 
let $kval := normalize-space($val) 
return <value-per-path value='{$kval}' 
count='{count($leafs[. eq  $kval ])}'/>} 

can i get the name of all attributes in each path $p
and get the count of their distint values to produce
it as the summary produced on leaf nodes

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the talk mailing list