Subject: RE: [xsl] Selection based on date comparison From: "Brinkman, Theodore" <Theodore.Brinkman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 30 Nov 2001 14:49:49 -0500 |
I would have thought to use substring to grab the substrings into variables and then piece the date back together into yyyymmdd format for easy comparison. Clumsy demo implementation of rebuild follows: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="./Untitled3.xsl"?> <date-sample> <date name="1" date="06/24/2001"/> <date name="2" date="05/29/2000"/> </date-sample> <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="date-sample"> <html> <body> <xsl:for-each select="date"> <xsl:variable name="date"><xsl:value-of select="substring(@date,7,4)"/><xsl:value-of select="substring(@date,1,2)"/><xsl:value-of select="substring(@date,4,2)"/></xsl:variable> <xsl:value-of select="@name"/>) <xsl:value-of select="@date"/> = <xsl:value-of select="$date"/><br/> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> - Theo -----Original Message----- From: Jeff Beadle [mailto:Jbeadle@xxxxxxxx] Sent: Friday, November 30, 2001 2:24 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] Selection based on date comparison why not use a parser extension, like msxsl for msxsl. You could construct javascript date objects and compare them. -----Original Message----- From: Dennis Campillo [mailto:dcampillo@xxxxxxx] Sent: Friday, November 30, 2001 2:15 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Selection based on date comparison >But the date format you choose is unsuited for compraision. Use >something like 20010603. >If you cant, you will have to use substring(). > Unfortunately, the date format is beyond my control at the moment, I understand I will have to use substring() in order to compare the dates. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Selection based on date c, Jeff Beadle | Thread | RE: [xsl] Selection based on date c, Jeff Beadle |
RE: [xsl] Selection based on date c, Jeff Beadle | Date | Re: [xsl] Divide and Conquer implem, Tom Myers |
Month |