[Bug 5261] [FO] errors in cast vs. construction

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5261

           Summary: [FO] errors in cast vs. construction
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators
        AssignedTo: mike@saxonica.com
        ReportedBy: tim@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


XQTS contains two similar tests, K2-SeqExprCast-248

xs:integer(xs:float("INF"))

which expects error FORG0001 (Invalid value for cast/constructor)

and CastAs180

xs:float("INF") cast as xs:integer

which expects error FOCA0002 (Invalid lexical value).

Since construction and casting both normalize to the same form, these should
surely expect the same error.  Personally, I'd favour FORG0001.

Relevant areas of the specification are:

http://www.w3.org/TR/xquery-operators/#casting-to-numerics
17.1.3.3 Casting to xs:decimal
17.1.3.4 Casting to xs:integer

"If SV is one of the special xs:float or xs:double values NaN, INF, or -INF, an
error is raised [err:FOCA0002]."

and

http://www.w3.org/TR/xquery/#id-cast

"If casting from the input type to the target type is supported but
nevertheless it is not possible to cast the input value into the value space of
the target type, a dynamic error is raised. [err:FORG0001] This includes the
case when any facet of the target type is not satisfied. For example, the
expression "2003-02-31" cast as xs:date would raise a dynamic error."

Note that the latter does not even mention the possibility of FOCA0002.

Received on Friday, 9 November 2007 08:46:23 UTC