Hi All,
The following error message is thrown "Required item type of first argument of seconds-from-dateTime() is xs:string; supplied value has item type xs:dateTime" when I try to execute <xforms:output ref="seconds-from-dateTime(xs:dateTime('2010-11-11T13:56:47-07:00'))"/> Where am I going wrong?? regards --SD |
ssethia,
the seconds-from-dateTime() function that's part of XForms 1.1 has a different signature then the seconds-from-dateTime() as defined in XPath 2.0. The former (XForms 1.1) expects a "string" and returns a "nubmer", the latter (XPath 2.0) expects a xs:dateTime and returns a xs:decimal. Obviously, you can't "force" the XForms engine to use the XPath 2.0 function by passing a xs:dateTime value; it's the XForms function that's executed. So, just drop the xs:dateTime cast and replace the ref by a value -> works perfectly :-) <xforms:output value="seconds-from-dateTime('2010-11-11T13:56:47-07:00')"/> HTH florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Florain,
Thanks, it works but the return value is a huge integer (1289509005) also all the remaining functions {eg: minutes-from-dateTime(xs:dateTime(time))} works smoothly except this one. Why is it so that the seconds-from-dateTime needs a string while the minutes-from-dateTime doesn't. regards --SD |
ssethia,
> Thanks, it works but the return value is a huge integer (1289509005) correct - that's what the xforms 1.1 seconds-from-dateTime should return. It doesn't extract the seconds part of the dateTime value but computes the seconds since 1970-01-01T00:00:00Z (1). > also all the remaining functions {eg: minutes-from-dateTime(xs:dateTime(time))} > works smoothly except this one. Why is it so that the seconds-from-dateTime > needs a string while the minutes-from-dateTime doesn't. hmm - i'm not sure... regarding minutes-from-dateTime, there's no XForms 1.1 function with the same name, so it seems that the XForms functions take precedence if there's a name conflict, but the XPath functions are still available. So, the next question would be how to persuade the XForms processor to handle seconds-from-dateTime as XPath function... (1) http://www.w3.org/TR/2009/REC-xforms-20091020/#fn-seconds-from-dateTime florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Thanks a lot.
On Fri, Feb 18, 2011 at 2:31 PM, Florian Schmitt <[hidden email]> wrote: ssethia, -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
SD,
As noted, seconds-from-dateTime() is defined both in XForms and in XPath 2.0. For some reason we have never noticed this conflict.
In XForms 1.0 and 1.1, its signature takes a string, and its meaning is different from XPath 2.0's: it returns the number of seconds since 1970-01-01T00:00:00Z.
The XForms 1.1 function is the one kicking in in Orbeon Forms, and this is why you are seeing a large number.
I am not sure we have a workaround for this at this time. As I don't like so much the time/date functions from XForms, I am tempted to say that the XPath 2.0 function should be the one kicking in instead, and that xforms: seconds-from-dateTime() would give access to the XForms version.
Thoughts?
-Erik
On Fri, Feb 18, 2011 at 12:24 PM, ssethia <[hidden email]> wrote:
On Fri, Feb 18, 2011 at 2:14 PM, Snehadeep Sethia <[hidden email]> wrote: Thanks a lot. -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Erik,
I agree with you, the XPath function is better. I'm wondering as to why only seconds-from-dateTime() is triggered via XForms 1.0 or 1.1 while minutes-from-dateTime() still triggers the XPath 2.0 function. regards --SD |
Administrator
|
SD,
The answer is easy: because there is no minutes-from-dateTime() in the XForms function library ;) BTW the XForms Working Group has agreed this week that this is an issue, and for the official XPath 2.0 support in XForms 1.2, it has been decided to remove the XForms version of seconds-from-dateTime().
The rationale is that this function was to help with date comparison. Since date comparison is built into XPath 2.0, the use case for it has disappeared.
Since probably nobody is using the XForms version of this function, we have now moved it to xforms:seconds-from-dateTIme():
-Erik On Thu, Feb 24, 2011 at 10:21 AM, SD <[hidden email]> wrote:
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Erik,
That clears all my doubts, and happy to hear that Xforms Working Group hass agreed on this change regards --SD
On Thu, Feb 24, 2011 at 9:53 PM, Erik Bruchez <[hidden email]> wrote: SD, -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |