Editor's draft XForms 1.1 spec update for seconds-to/from-dateTime()

The editor's draft of XForms 1.1 (available from our home page) has been 
updated again.
Specifically, the functions seconds-to-dateTime() and 
seconds-from-dateTime() were modified.
The first modification was to complete an action item pertaining to the 
group resolution that these functions to not support leap seconds.
The second modification was to complete spec-ready text for the problem I 
reported in [1]

[1] http://lists.w3.org/Archives/Public/www-forms-editor/2007Sep/0053.html

Based on the spec ready text, it is easy to now see that this is a small 
change in terms of implementation, which is appropriate as we approach CR 
(which is the call for implementations).

The change is also important for completing the desired modification to 
XForms 1.1 to allow it basic date math capabilities. With the change, the 
second expression below is able to compute 2 hours from now with the same 
order of magnitude complexity as computing 2 days from now, which is shown 
as the first expression below:

days-to-date(days-from-date(local-date()) + 31)

seconds-to-dateTime(seconds-from-dateTime(local-dateTime(), false()) + 
7200, false())

By way of reminder, an expression like the latter is simply not possible 
without the change and indeed can only be accomplished with the creation 
of extra temporary instance variables, as follows:

<bind nodeset="tz" calculate="substring(local-date(), 11, 6)"/>
<bind nodeset="duration" calculate="concat('PT', substring(../tz, 2, 2), 
'H', substring(../tz, 5, 2), 'M') "/>
<bind nodeset="temp" 
calculate="seconds-to-dateTime(seconds-from-dateTime(now()) + 7200 - 
seconds(../duration))"/>
<bind nodeset="newtime" calculate="concat(substring(../temp, 1, 
string-length(../temp)-1), ../tz)"/>

Hence, the final point about this change is that it is important to us 
from the standpoint of better alignment with XPath 2.0.  Although the 
native date math available in XPath 2.0 will make it more natural to do 
date math, it is important that the date math available in XForms 1.1 
should not cause a fundamentally different construct to be used, such as a 
set of expressions and temporary instance variables as these patterns will 
be much more difficult to spot and upgrade to XForms 2.0. 

Cheers,
John M. Boyer, Ph.D.
STSM: Lotus Forms Architect and Researcher
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com 

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer

Received on Wednesday, 3 October 2007 01:13:54 UTC