[xquery-talk] divide by zero
David Carlisle
davidc at nag.co.uk
Thu May 25 12:50:16 PDT 2006
> but i got errors
you have the syntax for let wrong: it needs to be used with return.
if (count($paths[.=$papa]) = 0)
then
let $rat:=1 <--- this is an incomplete expression
else
let $rat:=count($paths[.=$papa]) <-- and so is this
just do as originally suggested and replace
zzzz div grrrr
by
zzzz div max((1,grrr))
so in your case
<RATIO>
{
round( count($paths[.=$p]) div max((1,count($paths[.=$papa]))) * 100 )
}
</RATIO>
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
More information about the talk
mailing list