This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: NaN
- From: "G. Ken Holman" <gkholman at CraneSoftwrights dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 26 Feb 2002 12:50:50 -0500
- Subject: Re: [xsl] NaN
- Reply-to: xsl-list at lists dot mulberrytech dot com
At 2002-02-26 12:18 -0500, Clark, Jason wrote:
>I want to see if the value of an attribute or element is a number or string.
>I tried using number(@value) != 'NaN', but it always returns false. How can
>I find if a value is a string or number.
The following will be true if the value is a number:
test="@value <= 0 or @value > 0"
The use of < and > will coerce the argument to a number, and NaN does not
pass either test. If the entire test results in false, then it must not
have been a number, otherwise one of the two would have been true if it
were a number.
I hope this helps.
................... Ken
--
Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO: June 17-21, 2002
- : 3-days XML Information Modeling: July 31-August 2, 2002
G. Ken Holman mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
ISBN 0-13-065196-6 Definitive XSLT & XPath
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1 Practical Formatting Using XSLFO
XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed),
articles, training(instructor-live,Internet-live,web/CD,licensed)
Next public training: 2002-03-01,04,05,06,11,15,04-08,09,10,11,
- 05-06,07,09,10,20,06-04,07,10,11,13,14,17,20,07-31
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list