[xquery-talk] divide by zero
fatma helmy
fatmahelmy2000 at yahoo.com
Thu May 25 03:47:19 PDT 2006
yes, i did something like this
if ($x=0) then 1 else $x
but i need it inside my code so i added
the following
for $p in distinct-values($paths)
let $papa:= replace($p,'/[^/]*$','')
let $leafs :=$j//text()[normalize-space()]
[string-join(ancestor-or-self::element()/name(),'/')
eq substring-after(string($p),"/") ]
return
<STATISTICS>
<PATH>
{string($p)}
</PATH>
<RATIO>
{ if (count($paths[.=$papa]) = 0) then let $rat:=1
else let $rat:=count($paths[.=$papa])
return
string( round( count($paths[.=$p]) div $rat * 100 )
)}
</RATIO>
{for $val in distinct-values( $leafs)
let $kval := normalize-space($val)
return <value-per-path value='{$kval}'
count='{count($leafs[. eq $kval ])}'/>}
</STATISTICS>
but i got errors
__________________________________________________
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