xsl-list
[Top] [All Lists]

RE: format-number

2003-02-26 14:58:29
Thanks!
That's what I was looking for....

-----Original Message-----
From: G. Ken Holman [mailto:gkholman(_at_)CraneSoftwrights(_dot_)com] 
Sent: Wednesday, February 26, 2003 4:42 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] format-number


At 2003-02-26 16:30 -0500, Michael Semcheski wrote:
I believe the poster was looking for information on whether a value 
passed to format-number() that is not a number could be made to return 
something other than NaN.

I would be interested if anyone could comment.

If that is truly what the poster was asking for, that is what 
<xsl:decimal-format> is for.  An example is below.

I hope this helps.

................ Ken

T:\ftemp>type semcheski.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                 version="1.0">

<xsl:output method="text"/>

<xsl:decimal-format name="michael" NaN="not a nice number"/>

<xsl:template match="/">
   A:  <xsl:value-of select="format-number( 1.23, '#.000', 'michael' )"/>
   B:  <xsl:value-of select="format-number( 'ab', '#.000', 'michael' )"/>
   C:  <xsl:value-of select="format-number( 2.34, '#.000', 'michael' )"/>
</xsl:template>

</xsl:stylesheet>

T:\ftemp>saxon semcheski.xsl semcheski.xsl

   A:  1.230
   B:  not a nice number
   C:  2.340
T:\ftemp>



--
Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO
                              North America:      June 16-20, 2003

G. Ken Holman                mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 0-13-140374-5                              Definitive XSL-FO
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1              Practical Formatting Using XSL-FO
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc


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

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



<Prev in Thread] Current Thread [Next in Thread>