XForms and dayTimeDuration

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

XForms and dayTimeDuration

Robert Leftwich
I'd like to be able to use dayTimeDuration's in an xform and was wondering what
the status of support for it in OPS is (as the compliance page is still to be
updated for v3.0) ?

In particular I have a a repeating list of durations - xforms calculated using
xs:dateTime(dt1)-xs:dateTime(dt2) - that I'd like to dynamically total, but
sum(//duration) fails with an error "Cannot convert string "PT2H30M" to a double
when evaluating 'sum(//duration)'". (Note that the dynamic calculation for each
individual duration is working perfectly which is great!)

Hmm.. this may be a Saxon issue as attempting to do the total using
<xsl:value-of select="sum(//duration)"/> results in the same error - I'll check
the latest Saxon release asap.

Any suggestions for alternative approaches to totalling durations gratefully
accepted :-)

Thanks

Robert




--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForms and dayTimeDuration

Robert Leftwich
I wrote:
>
> Hmm.. this may be a Saxon issue as attempting to do the total using
> <xsl:value-of select="sum(//duration)"/> results in the same error -
> I'll check the latest Saxon release asap.
>

I can verify that at least the xsl side of things works in Saxon 8.5.1. i.e. the
following works in the later version but fails in Saxon 8.1.1:

<xsl:value-of select="sum(time/xdt:dayTimeDuration(duration))"/>

with an error "Required type of second operand of '/' is node(); supplied value
has type xdt:dayTimeDuration".

(Note that the key is to cast the duration to an xdt:dayTimeDuration to 'inform'
sum() that all nodes are of the specified type).

Is it worthwhile/possible to upgrade OPS to the latest Saxon and if so, will
this enable an xforms calculation using sum() as above?

Robert





--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XForms and dayTimeDuration

Erik Bruchez
Administrator
Robert Leftwich wrote:

> I wrote:
>
>>
>> Hmm.. this may be a Saxon issue as attempting to do the total using
>> <xsl:value-of select="sum(//duration)"/> results in the same error -
>> I'll check the latest Saxon release asap.
>>
>
> I can verify that at least the xsl side of things works in Saxon 8.5.1.
> i.e. the following works in the later version but fails in Saxon 8.1.1:
>
> <xsl:value-of select="sum(time/xdt:dayTimeDuration(duration))"/>
>
> with an error "Required type of second operand of '/' is node();
> supplied value has type xdt:dayTimeDuration".
>
> (Note that the key is to cast the duration to an xdt:dayTimeDuration to
> 'inform' sum() that all nodes are of the specified type).
>
> Is it worthwhile/possible to upgrade OPS to the latest Saxon and if so,
> will this enable an xforms calculation using sum() as above?
It is worthwhile upgrading, however this is no trivial process as many
things have changed in Saxon between 8.1 and 8.5. We gave it a try
recently and hit a number of issues. It is likely a multi-day porting
effort (remember, we are integrating with the the Saxon XPath engine).

In the meanwhile, you may be able to extract information from the
duration before summing, like this:

sum(for $i in time/duration return
seconds-from-duration(xdt:dayTimeDuration(duration)) +
minutes-from-duration(xdt:dayTimeDuration(duration)) * 60 + ...)

or something in the same vein.

-Erik



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws