Re: ACTION-2029 - Check that integer promotes successfully to double


Isn’t for the input parameter value of NaN returning an empty sequence not quite close to an empty string? When the sequence is converted to a string it will be an empty string. And in a lot of cases we convert to string in XForms. There are of course cases where there will be a difference. But I think that the advantages of returning an xs:date (or xs:dateTime) overweigh the impact of the backwards incompatibility.


Nick Van den Bleeken

From: <<>> on behalf of Erik Bruchez
Date: Wednesday 2 September 2015 06:49
To: Public Forms, "<>"
Subject: ACTION-2029 - Check that integer promotes successfully to double
Resent-From: <<>>
Resent-Date: Wednesday 2 September 2015 06:50


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, namely:

- you can pass an `xs:decimal` to an `xs:double`, possibly with loss of precision
- `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 Friday, 11 September 2015 13:16:03 UTC