dbertoni    00/10/03 15:05:00

  Modified:    c/src/XSLT ElemNumber.cpp
  Log:
  Make sure NaN resolves to 0.
  
  Revision  Changes    Path
  1.25      +12 -3     xml-xalan/c/src/XSLT/ElemNumber.cpp
  
  Index: ElemNumber.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.cpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ElemNumber.cpp    2000/09/19 15:11:45     1.24
  +++ ElemNumber.cpp    2000/10/03 22:04:56     1.25
  @@ -67,6 +67,7 @@
   
   
   #include <PlatformSupport/DOMStringHelper.hpp>
  +#include <PlatformSupport/DoubleSupport.hpp>
   #include <PlatformSupport/XalanAutoPtr.hpp>
   #include <PlatformSupport/XalanNumberFormat.hpp>
   #include <PlatformSupport/XalanUnicode.hpp>
  @@ -150,7 +151,6 @@
                {
                        m_format_avt = new AVT(aname, atts.getType(i),
                                                atts.getValue(i), *this, 
constructionContext);
  -
                }
                else if(equals(aname, Constants::ATTRNAME_LANG))
                {
  @@ -379,8 +379,17 @@
                                executionContext.getXObjectFactory(),
                                m_valueExpr->execute(sourceNode, *this, 
executionContext));
                assert(countObj.get() != 0);
  +
  +             const double    theValue = countObj->num();
   
  -             numberList.push_back(int(countObj->num()));
  +             if (DoubleSupport::isNaN(theValue) == true)
  +             {
  +                     numberList.push_back(0);
  +             }
  +             else
  +             {
  +                     numberList.push_back(int(theValue));
  +             }
        }
        else
        {
  @@ -716,7 +725,7 @@
                {
                        assert(!isLetterOrDigit(charAt((*it), 0)));
                        sepString = *it++;
  -             }                       
  +             }
                formattedNumber += getFormattedNumber(executionContext, 
contextNode,
                                numberType, numberWidth, theList[i]);
                // All but the last one
  
  
  

Reply via email to