Formatting Numbers and Dates

Subject: Formatting Numbers and Dates
From: Senthil Vaiyapuri <senthil@xxxxxxxxxx>
Date: Fri, 23 Jul 1999 08:25:50 -0700
  Howdy,

     Are there builtin ways (methods) available in XSL to format
     numbers and Dates?  With IE5, I could use formatNumber()
     and formatDate() methods (as shown below).  But this
     apparent extenstion (<xsl-eval>) makes the style sheet not
     portable.

				/* DATE_F - contains a unix time() value */

     <xsl:apply-templates select="DATE_F">
     <xsl:template match="DATE_F">
          <TD align="center">
		<FONT size="2"><xsl:eval>formatDate(new
Date(parseInt(this.text) * 1000).getVarDate(), "MMM dd
yyyy")</xsl:eval></FONT>
          </TD>
     </xsl:template>
     </xsl:apply-templates>

				/* NUM_F contains a decimal, with no
trailing zeroes */
    <xsl:apply-templates select="NUM_F">
    <xsl:template match="NUM_F">
          <TD align="center">
		<FONT size="2"><xsl:eval>formatNumber(this.nodeTypedValue,
"0.00")</xsl:eval></FONT>
          </TD>
    </xsl:template>
    </xsl:apply-templates>


     Thanks in advance..
     -senthil

----------------------------------------------------------------------------
---------
Senthil Vaiyapuri
408-861-4691
Portal Software


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


Current Thread