GNOME Bugzilla – Bug 93444
date:difference() failing when return value is < 0
Last modified: 2009-08-15 18:40:50 UTC
% xsltproc --version Using libxml 20423, libxslt 10019 and libexslt 710 xsltproc was compiled against libxml 20423, libxslt 10019 and libexslt 710 libxslt 10019 was compiled against libxml 20423 libexslt 710 was compiled against libxml 20423 With the following stylesheet/XML file (adapted from tests/exslt/date/difference.1.xml) I get strange output from xsltproc: % xsltproc difference.1.xsl a.xml difference : 1970-01-01T05:04:03 - 1970-01-01T04:03:02 result : PT1H1M1S difference : 2000-01-01T05:00:03 - 2000-01-01T04:03:02 result : PT57M1S difference : 2000-01-01T05:00:03 - 1980-01-01T04:03:02 result : P7305DT57M1S difference : 1970-01-01T04:03:02 - 1970-01-01T05:04:03 result : -PT1H1M1S difference : 2000-01-01T04:03:02 - 2000-01-01T05:00:03 result : -PT57M1S difference : 1980-01-01T04:03:02 - 2000-01-01T05:00:03 result : -P-7305DT57M1S The last three results should be the "negative" of the first three results, which seem okay when the day is the same but not for the last one, when the day is different (I expected a result of -P7305DT57M1S). % cat a.xml <?xml version="1.0"?> <page> <!-- examples from tests/exslt/date/dfference.1.xml --> <date date1='1970-01-01T05:04:03' date2='1970-01-01T04:03:02'/> <date date1='2000-01-01T05:00:03' date2='2000-01-01T04:03:02'/> <date date1='2000-01-01T05:00:03' date2='1980-01-01T04:03:02'/> <!--* reverse some of these *--> <date date2='1970-01-01T05:04:03' date1='1970-01-01T04:03:02'/> <date date2='2000-01-01T05:00:03' date1='2000-01-01T04:03:02'/> <date date2='2000-01-01T05:00:03' date1='1980-01-01T04:03:02'/> </page> % cat difference.1.xsl <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date"> <xsl:output method="text"/> <xsl:strip-space elements="*"/> <xsl:template match="date"> <xsl:text>difference : </xsl:text><xsl:value-of select="@date1"/> - <xsl:value-of select="@date2"/> <xsl:text> </xsl:text> <xsl:text>result : </xsl:text><xsl:value-of select="date:difference(@date1,@date2)"/> <xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet>
Hum, is that related to bug #92818 http://bugzilla.gnome.org/show_bug.cgi?id=92818 Daniel
Okay Igor Zlatkovic and Charlie Bozeman have fixed this problem in CVS, this should be in the next release, thanks for the report, Daniel
Should be closed with the last release, thanks, Daniel