Re: [xslt] Troubles with the EXSLT date extensions



Doh! I implemented difference backwards. I should have been subtracting y - x 
(like you did). This means that the seconds function is also wrong.
However, I was trying to show that it is still possible for multiple items in 
the duration object to have negative values which the format function will not 
handle correctly (i.e. embedded '-' in the output string). See the new patch for 
an example.
I'll start making changes.

Charlie B.

Quoting Igor Zlatkovic <igor@stud.fh-frankfurt.de>:

> Hi there,
> 
> > You need to check the case of both negative days and seconds,
> otherwise
> the
> > result will end up with a negative sign in front of days after it is
> formatted.
> > I have attached a newer patch to difference.1.xml to illustrate the
> problem.
> 
> Hmm... if both days and seconds are negative, then the result should
> be
> negative, not true? Here is the current result with my code and the
> data
> from your patch:
> 
> <!-- from bug #93444 -->
> 1970-01-01T04:03:02 - 1970-01-01T05:04:03 = PT1H1M1S
> 2000-01-01T04:03:02 - 2000-01-01T05:00:03 = PT57M1S
> 1980-01-01T04:03:02 - 2000-01-01T05:00:03 = P7305DT57M1S
> <!-- from bug #92818 -->
> 2002-05-02T23:59:59 - 2002-05-03T00:00:01 = PT2S
> 2002-05-03T00:00:01 - 2002-05-02T23:59:59 = -PT2S
> <!-- result should be negative -->
> 2000-01-01T04:03:02 - 2000-01-02T05:00:03 = P1DT57M1S
> 
> The last example is okay. It should not be negative, as the comment
> suggests, because the first date occurs before the second and
> http://exslt.org/date/functions/difference/index.html indicates that
> the
> resulting duration is positive in that case. Other results are okay as
> well.
> 
> Am I missing something?
> 
> Ciao
> Igor
> 
> _______________________________________________
> xslt mailing list, project page http://xmlsoft.org/XSLT/
> xslt@gnome.org
> http://mail.gnome.org/mailman/listinfo/xslt
> 

difference.1.xml-pat



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]