W3C home > Mailing lists > Public > public-qt-comments@w3.org > October 2002

RE: F&O avg and sum should automatically cast anySimpleType to n umeric

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Tue, 8 Oct 2002 13:33:39 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E621060453DC56@daemsg02.software-ag.de>
To: John Mercado <johnkmercado@yahoo.com>, XQuery Comments <public-qt-comments@w3.org>

John Mercado: 
> >From the way I read the descriptions of the avg and
> sum functions, you can't use them if the values in the
> sequence aren't explicitly typed as numbers.  For
> example, if my instance is:
> <root>
>   <num>12</num>
>   <num>15</num>
> </root>
> I can't say sum(//num) unless I have a schema that
> declares that num has a numeric type.  
> This seems like a major inconvenience and an
> incompatibility with XPath 1.0.  I hope I'm missing
> something.
> Of course, it may be that when the spec says "If,
> after this, $srcval contains only numbers..." it means 
> "contains only atomic values with numeric types _or_ 
> anySimpleType values that can be cast to numeric types." Is 
> that the part I'm missing?

I'm sure it wasn't anyone's intent to stop sum() working with untyped data,
and you are right, the spec is very unclear on this point.

Michael Kay
Received on Tuesday, 8 October 2002 07:33:49 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:43 UTC