xsl-list
[Top] [All Lists]

Peculiar Problem in .xsl file

2002-12-05 22:49:35
Hi Guys,
I am trying to print out a html file with a date in words, given date in a xml file in number format
XSL file:
<xsl:variable name='month' select='substring ($date, 5, 2)'/>
        <xsl:choose>
                <xsl:when test='$month=01'>
                        <xsl:text>January </xsl:text>
                </xsl:when>
                <xsl:when test='$month=02'>
                        <xsl:text>February </xsl:text>
                </xsl:when>
                <xsl:when test='$month=03'>
                        <xsl:text>March </xsl:text>
                </xsl:when>
                <xsl:when test='$month=04'>
                        <xsl:text>April </xsl:text>
                </xsl:when>
                <xsl:when test='$month=05'>
                        <xsl:text>May </xsl:text>
                </xsl:when>
                <xsl:when test='$month=06'>
                        <xsl:text>June </xsl:text>
                </xsl:when>
                <xsl:when test='$month=07'>
                        <xsl:text>July </xsl:text>
                </xsl:when>
                <xsl:when test='$month=08'>
                        <xsl:text>August </xsl:text>
                </xsl:when>
                <xsl:when test='$month=09'>
                        <xsl:text>September </xsl:text>
                </xsl:when>
                <xsl:when test='$month=10'>
                        <xsl:text>October </xsl:text>
                </xsl:when>
                <xsl:when test='$month=11'>
                        <xsl:text>November </xsl:text>
                </xsl:when>
                <xsl:when test='$month=12'>
                        <xsl:text>December </xsl:text>
                </xsl:when>
        </xsl:choose>

When valuepassed into the date variable is 20020516, I don't get a month. Infact if the month is from 01 to 09, I dont get a month in words. If the month is 10 to 12, I get a month displayed. Very very peculiar. I am unable to find the solution. I tried and printed out the value of the month variable. It seems to take the 2 digits correctly. However it doesn't go into the appropraite month code when the month starts with 0!! For example, if the month is 05, it doesnt go into this part of the code:
<xsl:when test='$month=05'>
<xsl:text>May </xsl:text>
</xsl:when>
If the month were 10, 11 or 12, the code works fine.
Can anyone guess what the problem is...
Thanks in advance,
Chandra



_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list