|
next
|
Subject: Comparing Dates With ASP.NET 2.0 And XSLT Author: Dominic Neagle Date: 08 Jan 2008 04:20 AM Originally Posted: 08 Jan 2008 04:19 AM
|
Hi all,
Basically, my question is, how can I compare to dates?
The dates are in the following format:
<date>08/01/2008 9:13:45</date>
What I need to do is compare the date in the XML file (as shown above) with another date (that gets passed into the XSLT file). If the first date (from the XML file) is greater than the second date (which was passed in) then I need it to display the date.
My code is the following:
<!-- value passed in from a .NET page -->
<xsl:param name="date_start"></xsl:param>
<xsl:if test="Date > $date_start">
<p><xsl:value-of select="DateTime" /></p>
</xsl:if>
The trouble is, even when the condition returns true, the date is never output.
Is the date in the correct format for comparison, or do I need to change it somehow? The process that creates the XML file containing the dates can't really be changed, so the dates have to be recorded in the format that they are currently, so will I have to do some jiggling about with the format from within the XSLT stylesheet?
If it helps, I'm using ASP.NET 2.0 web pages to actually apply the XSLT stylesheet to the XML file and display the results, so I'm not entirely sure what processor is being used. I imagine the .NET Framework has it's own processor built in. I'm also not using (and cant install) any EXSLT thing-me-bobs.
Any help would be muchos appreciated! Thanks!
:)
|
|
|