This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Selection based on date comparison


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@manh.com]
Sent: Friday, November 30, 2001 2:24 PM
To: xsl-list@lists.mulberrytech.com
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@msn.com]
Sent: Friday, November 30, 2001 2:15 PM
To: xsl-list@lists.mulberrytech.com
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]