Re: [xslt] Problem with date:seconds
- From: cbozeman hiwaay net
- To: xslt gnome org
- Subject: Re: [xslt] Problem with date:seconds
- Date: Wed, 27 Nov 2002 15:16:21 -0600 (CST)
versions 1.0.21 and later are correct (by my interpretation of the EXSLT
documentation). The date:seconds function uses date:difference to determine a
duration between your date/time and 1970-01-01:00:00:00Z which is then
converted to seconds. Since your date/time value is later than 1970 the result
is negative. I had originally coded the difference function backwards but a
user (I forget who) noticed the error and Igor fixed it.
Charlie B.
Quoting Bernhard Zwischenbrugger <datenkueche2001@yahoo.de>:
> Hi all
>
> I have a little problem with the date:seconds
> function.
> The Result is sometimes a positive integer and
> sometimes a negative integer.
>
> The older 1.0.20 version of libxslt is working better
> than the newer 1.0.21, but maybe it depends on the
> operating System.
>
>
> EXAMPLE:
> --------
> <?xml version="1.0"?>
> <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="xml" encoding="utf-8"
> indent="yes"/>
> <xsl:variable
> name="datetime">2002-11-26T19:41:52</xsl:variable>
>
> <xsl:template match="/">
> <xsl:value-of select="date:seconds($datetime)"/>
> </xsl:template>
>
> </xsl:stylesheet>
>
> 1.RESULT (Linux 2.4.18-4GB):
> ---------
>
> xsltproc date.xslt date.xslt
> <?xml version="1.0" encoding="utf-8"?>
> 1038339712
>
>
> xsltproc -V
> Using libxml 20424, libxslt 10020 and libexslt 711
> xsltproc was compiled against libxml 20424, libxslt
> 10020 and libexslt 711
> libxslt 10020 was compiled against libxml 20424
> libexslt 711 was compiled against libxml 20424
>
> 2. Result
> ----------
> linuxstefan:/web/test # xsltproc date.xsl date.xsl
> <?xml version="1.0" encoding="utf-8"?>
> -1038339712
>
> linuxstefan:/web/test # xsltproc -V
> Using libxml 20425, libxslt 10021 and libexslt 712
> xsltproc was compiled against libxml 20425, libxslt
> 10021 and libexslt 712
> libxslt 10021 was compiled against libxml 20425
> libexslt 712 was compiled against libxml 20425
>
> 3. Result (Solaris)
> -----------
> vdcrtmp1 # /usr/local/bin/xsltproc date.xsl date.xsl
> <?xml version="1.0" encoding="utf-8"?>
> -1038339712
>
> vdcrtmp1 # /usr/local/bin/xsltproc -V
> Using libxml 20425, libxslt 10021 and libexslt 712
> xsltproc was compiled against libxml 20425, libxslt
> 10021 and libexslt 712
> libxslt 10021 was compiled against libxml 20425
> libexslt 712 was compiled against libxml 20425
>
> thanx
>
> Bernhard
> http://datenkueche.com
>
> __________________________________________________________________
>
> Gesendet von Yahoo! Mail - http://mail.yahoo.de
> Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de
> _______________________________________________
> xslt mailing list, project page http://xmlsoft.org/XSLT/
> xslt@gnome.org
> http://mail.gnome.org/mailman/listinfo/xslt
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]