[xquery-talk] deleting certain path from a list and all paths containing that path

fatma helmy fatmahelmy2000 at yahoo.com
Sat Jun 3 10:10:57 PDT 2006


i need to delete from $paths the path which does not
satify a certain condition and also all paths contain
that path. i need to add this condition in the
following query in the place of /**** 

declare function local:pathOfNode($node)
 {
 string-join($node/ancestor-or-self::*/local-name(),
 '/') };
 let $j:= . 
 
 let $paths := for $n in $j/*//* return
 local:pathOfNode($n)
 
 for $p in distinct-values($paths) 
  
 let $papa:= replace($p,'/[^/]*$','')
/********************
if count($paths[.=$p]div count($paths[.=$papa]) <
certain_valuse {delete $p from $paths and delete from
$paths all paths that contain $p}
else
/**********************


 let $leafs :=$j//text()[normalize-space()]
[string-join(../ancestor::*/local-name(), '/') eq $p
 ] 
 
 return 
 <STATISTICS>
   <PATH> {string($p)} </PATH> 
   <RATIO> {let $c := count($paths[.=$papa]) return
            string( round( count($paths[.=$p]) div
 (if ($c=0) then 1 else $c)
 * 100 ) )}</RATIO>
 {for $val in  distinct-values($leafs) return
  <value-per-path value='{$val}' 
 count='{count($leafs[. eq  $val ])}'/>} 
 
 </STATISTICS> 





__________________________________________________
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