[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()]
eq substring-after(string($p),"/") ] 
{ if (count($paths[.=$papa]) = 0) then let $rat:=1
else let $rat:=count($paths[.=$papa])
  string( round( count($paths[.=$p]) div $rat * 100 )
{for $val in  distinct-values( $leafs) 
let $kval := normalize-space($val) 
return <value-per-path value='{$kval}' 
count='{count($leafs[. eq  $kval ])}'/>} 

but i got errors

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

More information about the talk mailing list