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

ACTION-2023: Check compatibility problems with seconds-from-datetime and one other

From: Erik Bruchez <erik@bruchez.org>
Date: Tue, 25 Aug 2015 21:45:27 -0700
Message-ID: <CAAc0PEUyKTd_c6NLmsy-fiko8bBQK+x5iPfC_vZVtDc2cdOSyg@mail.gmail.com>
To: Forms WG <public-forms@w3.org>, "public-xformsusers@w3.org" <public-xformsusers@w3.org>
All,

## The seconds-from-dateTime() function

In XPath 2.0:

   fn:seconds-from-dateTime($arg as xs:dateTime?) as xs:decimal?

   "Returns an xs:decimal value greater than or equal to zero and less
than 60, representing the seconds and fractional seconds in the
localized value of $arg. If $arg is the empty sequence, returns the
empty sequence."

In XForms 1.1:

   xf:seconds-from-dateTime($arg as xs:string) as xs:decimal

    "This function returns a possibly fractional number of seconds,
according to the following rules:
If the string parameter represents a legal lexical xsd:dateTime, the
return value is equal to the number of seconds difference between the
specified dateTime (normalized to UTC) and 1970-01-01T00:00:00Z. If no
time zone is specified, UTC is used. Any other input string parameter
causes a return value of NaN. This function does not support leap
seconds."

In other words, the two functions are named the same but do something
completely different.

I suggest the following solution:

1. In XPath 1.0 backwards compatibility mode, the XForms 1.1 function
is scoped, and the XPath 2.0 function is not available.

2. In XPath 2.0 mode, the standard XPath 2.0 function is scoped in the
default namespace, and the XForms 1.1 function scope in the XForms
namespace.

This is kind of explained already at the beginning of "4 The XForms
Function Library":

    "The functions are available in the XForms namespace. When the
XPath version on the model is 1.0 or omitted the functions are also
available in the default function namespace. Additionally all
functions defined as built-in function and the operators in [Functions
and Operators] are also available in XForms.
For backwards compatibility an implementation may make these
additional functions also available in the default function namespace
when the XPath version on the model is not 1.0. When the additional
function is also available in [Functions and Operators], an
implementation should not override that function in the default
function namespace (e.g.: when xpath version on the model is 2.0
invoking replace() will invoke the replace function defined in
[Functions and Operators])."

But I find that wording confusing, and we should improve it.

## The adjust-dateTime-to-timezone() function

Similar to seconds-from-dateTime(), this function clashes with the
XPath 2.0 function. Same solution:

1. In XPath 1.0 backwards compatibility mode, the XForms 1.1 function
is scoped, and the XPath 2.0 function is not available.

2. In XPath 2.0 mode, the standard XPath 2.0 function is scoped in the
default namespace, and the XForms 1.1 function scope in the XForms
namespace.

## replace() and matches()

These function make sense only in XPath 1.0 backwards compatibility
mode, and they are imported from XPath 2.0. In XPath 2.0 mode, we just
use the standard XPath 2.0 functions, and don't place them in the
XForms namespace.

In fact, I think that we shouldn't even bother about replace() and
matches() in XPath 1.0 backwards compatibility mode, and that we
should remove "4.1.7 The matches() Function" and "4.3.5 The replace()
Function" from the spec.

-Erik
Received on Wednesday, 26 August 2015 04:46:19 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 26 August 2015 04:46:19 UTC