|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Date Difference
since xslt2 seems to be ok,something like this seems to work (returning
-1 0 or 1 depending whether the dates are greater equal or less) this is
assuming us date format, switch round [1] and [2] for ddmmyyyy.
<xsl:stylesheet
version="2.0"
xmlns:x="data:,x"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:function name="x:date">
<xsl:param name="d1"/>
<xsl:variable name="s" select="tokenize($d1,'/')"/>
<xsl:value-of
select="xs:integer($s[3])*10000+xs:integer($s[1])*100+xs:integer($s[2])"/>
</xsl:function>
<xsl:template name="main">
:<xsl:value-of
select="compare(x:date('9/11/2004'),x:date('10/25/2005'))"/>
:<xsl:value-of
select="compare(x:date('10/25/2005'),x:date('9/11/2004'))"/>
:<xsl:value-of
select="compare(x:date('10/25/2005'),x:date('10/25/2005'))"/>
</xsl:template>
</xsl:stylesheet>
$ saxon8 -it main date1.xsl
<?xml version="1.0" encoding="UTF-8"?>
:-1
:1
:0
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








