title: SUM not working in xsl
body: <p>I want to sum up the totals for a column in xsl. It sums up the column for KGS but it doesn't sum up for Grams. If the Grams column doesn't have any data instead of showing NA it must show a (-) this part works. What am I doing wrong that it's not adding up the total for gram?</p>
  
  <pre><code>&lt;xsl:decimal-format name="MyFormat" NaN=" - " zero-digit="0"/&gt;  // f.h
  &lt;xsl:template match="/"&gt;
    &lt;table width="100%" border="1"&gt;
   &lt;tr&gt;
        &lt;td colspan="12" bgcolor="#66FFCC"&gt;&lt;div align="center"&gt;&lt;strong&gt; Totals&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td width="5%"&gt;&lt;div align="center"&gt;&lt;strong&gt;Mass (kg)&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;
   &lt;td width="5%"&gt;&lt;div align="center"&gt;&lt;strong&gt;Grams&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;
  &lt;/tr&gt;
    &lt;xsl:for-each select="Rowsets/Rowset/Row/DATE_WEIGHED"&gt;
        &lt;tr&gt;
        &lt;td&gt;&lt;div align="center"&gt;&lt;xsl:value-of select="../KG"/&gt;&lt;/div&gt;&lt;/td&gt;
        &lt;td&gt;&lt;div align="center"&gt;&lt;xsl:value-of select="format-number(../Grams,'#,###','MyFormat')/&gt;&lt;/div&gt;&lt;/td&gt;
  
     &lt;/tr&gt; 
    &lt;/xsl:for-each&gt;
     &lt;td bgcolor="#FFCC99"&gt;&lt;div align="center"&gt;&lt;strong&gt;&lt;xsl:value-of select="sum(Rowsets/Rowset/Row/KG)"/&gt;&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;td bgcolor="#FFCC99"&gt;&lt;div align="center"&gt;&lt;strong&gt;&lt;xsl:value-of select="format-number(sum(Rowsets/Rowset/Row/Grams),'#,###','MyFormat')"/&gt;&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;/table&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>