Chandra - wrote:
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>
You're right, it ought to work.
Since =01 is the same as =1 (you didn't put the number in quotes, so it's a
number, not a string), there's no need for the leading zero.. perhaps you
meant "01" (with quotes). Shouldn't matter, though.. the string comparison
should not provide different results than the numeric comparison.
<xsl:value-of select="'01'=1"/>
and
<xsl:value-of select="'01'=01"/>
should both give you 'true' ... do they? If not, what XSLT processor are
you using? File a bug report!
Meanwhile, try this solution:
<xsl:variable name="months" select="'January February March April May
June July August SeptemberOctober November December '"/>
<xsl:value-of
select="concat(normalize-space(substring($months,1+9*(substring($date,5,2)-1),9)),'
')"/>
Mike
--
Mike J. Brown | http://skew.org/~mike/resume/
Denver, CO, USA | http://skew.org/xml/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list