Re: [Use cases] More issues

> 1) in the R use cases, a user defined function is introduced:
> 
> declare function local:dec-max($i as item()*)
>   as xs:decimal
> {
>      max( for $j in $i return xs:decimal($j) )
> };
> In a couple of cases (Q2 and Q6) the list of items provided to the 
> function is empty, so "max" returns an empty sequence too. In this case,

> an error is raised, because an xs:decimal cannot be constructed from an 
> empty sequence.
> In my opinion, the return value should be changed into an xs:decimal?

The real problem here is in the definition of the function itself. It must
be:

declare function local:dec-max($i as item()+)
   as xs:decimal
{
  {* Whatever code here *}
}

It is meaningless to ask for the maximum of an empty sequence -- then why
should the empty sequence be allowed as argument?




=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

Received on Saturday, 11 October 2003 03:10:16 UTC