Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

NaN Values

The term NaN, which stands for "not a number," means a symbolic entity that represents a value not otherwise available in floating-point format.

There are two kinds of NaNs.

Represent unknown or uninitialized values.

Represent symbolic values and values that are too big or too precise for the format. Signaling NaNs raise an invalid operation exception whenever an operation is attempted on them.

Code Example

The following example shows how to compare any value to a NaN value.

XML File (NaNValues.xml)

<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="NaNValues.xsl" ?>

XSLT File (NaNValues.xsl)

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

<xsl:template match="items">
 <xsl:for-each select="item">
  <xsl:call-template name="IsNaN"/>

<xsl:template name="IsNaN">
 <!-- Parameter defined here -->
 <xsl:param name="var" select="."/>
 <xsl:value-of select="$var"/>
 <xsl:if test="string(number($var)) = 'NaN'"> is a string. </xsl:if>
 <xsl:if test="string(number($var)) != 'NaN'"> is a number. </xsl:if>


This is the output:

100 is a number. ABC is a string.

Build Date:


Community Additions

© 2015 Microsoft