Re: [xsl] XSLT number() problem

Subject: Re: [xsl] XSLT number() problem
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 19 Jun 2002 23:43:51 +0100
Tom Passin wrote:
> Your example worked fine for me. You can also simplify the test like
> this:
>
> <xsl:if test='number(@FieldA)'>

Note that this test also returns false if the FieldA attribute is 0,
which may or may not be desired. To test whether the numeric value of
the FieldA attribute is NaN, you can alternatively use:

  <xsl:if test="number(@FieldA) = number(@FieldA)">
    ...
  </xsl:if>

This works because NaN is the only number for which $num = $num is
false.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread