Hi - I have a function that I've defined in XSLT that converts a date that looks like 1/4/2010 (Jan 4, 2010) into the ISO format 20100104. This is what my function looks like:
Code:
<xsl:function name="lbs:formatDateISO">
<xsl:param name="varDate"/>
<xsl:value-of select="number(concat(tokenize($varDate,'/')[3],substring('0',1,2 - string-length(tokenize($varDate,'/')[1])),tokenize($varDate,'/')[1],substring('0',1,2 - string-length(tokenize($varDate,'/')[2])),tokenize($varDate,'/')[2]))" />
</xsl:function>
I then use this function in another function that filters for dates that aren't within a given startDate and endDate. I use the > operator to compare dates for this and this part isn't working correctly. For example, the following code shouldn't return anything (since 1/10/2010 is "less than" 1/15/2010 and hence the test should fail) but it does return -5:
Code:
<xsl:if test="lbs:formatDateISO('1/10/2010') > lbs:formatDateISO('1/15/2010') ">
<xsl:value-of select="lbs:formatDateISO('1/10/2010') - lbs:formatDateISO('1/15/2010')"/>
</xsl:if>
The fact that the difference of -5 was computed correctly seems to indicate that the conversion to a number is working OK from the lbs:formatDateISO function (I confirmed this by printing out the values from this function). So I'm guessing the problem is with the greater-than operator > not working as expected? Would appreciate any help. Thanks!