W3C home > Mailing lists > Public > public-xformsusers@w3.org > September 2015

ACTION-2029 - Check that integer promotes successfully to double

From: Erik Bruchez <erik@bruchez.org>
Date: Tue, 1 Sep 2015 21:49:21 -0700
Message-ID: <CAAc0PEXeQfhZaGoV8xNiCwQ35+Rcok5p_nRd40BzjJSRYefkzg@mail.gmail.com>
To: Forms WG <public-forms@w3.org>, "public-xformsusers@w3.org" <public-xformsusers@w3.org>

This is the case AFAICT, for example, in XPath 2.0:

        $sourceString as xs:string?,
        $startingLoc as xs:double
    ) as xs:string

        $sourceString as xs:string?,
        $startingLoc as xs:double,
        $length as xs:double
    ) as xs:string

I assume that, for compatibility with XPath 1.0, these functions take
`xs:double` parameters. I checked that, with Saxon at least, passing an
`xs:integer` works, as we had suspected was the case based on the spec,

- you can pass an `xs:decimal` to an `xs:double`, possibly with loss of
- `xs:integer` is a subtype of `xs:decimal`
- therefore you can pass an `xs:integer` to an `xs:double`

This means that the following XForms functions can take `xs:double`:

- `days-to-date()` [1]
- `seconds-to-dateTime()` [2]

and so I fixed the types in the spec:


Doing so, I have found another issue in these two functions, namely the
following language from XForms 1.1:

> An input parameter value of NaN results in output of the empty string.

With the change to `xs:double`, the function parameters are now
backward-compatible. But the return types are not: in XForms 1.1, they were
`string`, and here they are `xs:date` or `xs:dateTime`.

We can either:

1. Change back the return types to `xs:string`, which is compatible with
XForms 1.1, but not XPath 2.0-friendly,
2. or use `xs:date?` and `xs:dateTime?` return types. A `NaN` parameter
returns the empty sequence.



Received on Wednesday, 2 September 2015 04:50:11 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:37:44 UTC