[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Formatting Numbers and Dates

Subject: RE: Formatting Numbers and Dates
From: "Emery, Ric" <ric.emery@xxxxxxx>
Date: Thu, 5 Aug 1999 09:14:21 -0700
eval format date
Not sure about formatting dates.

Formatting numbers can be achieved with the format-number function of XSL.
This function is described in section 14.3 of the latest XSL spec.

Here is an example that formats a variable to 2 decimal places.

<xsl:value-of select="format-number ($SOMENUMBER, '0.00')" />

-----Original Message-----
From: Senthil Vaiyapuri [mailto:senthil@xxxxxxxxxx]
Sent: Friday, July 23, 1999 8:26 AM
To: 'xsl-list@xxxxxxxxxxxxxxxx'
Subject: Formatting Numbers and Dates



  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


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.