Subject: Re: [xsl] Date Difference From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 20 Dec 2005 00:23:51 GMT |
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 ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Date Difference, David Carlisle | Thread | RE: [xsl] Date Difference, Michael Kay |
RE: [xsl] Date Difference, Haarman, Michael | Date | [xsl] stylesheet functions or named, Haarman, Michael |
Month |