title: How to count the number of records/nodes in the xslt only whose value is greater than zero
body: <p>My xml is as below :</p>
  
  <pre><code>&lt;Report_Entry&gt;
      &lt;FileDateTime&gt;2016-01-05T22:45:55.692-08:00&lt;/ FileDateTime&gt;
      &lt; CurrentYear&gt;2016&lt;/ CurrentYear&gt;
      &lt; MemNum&gt;133034&lt;/ MemNum&gt;
      &lt; SSN&gt;000000&lt;/ SSN&gt;
      &lt; First_Name&gt;Br&lt;/ First_Name&gt;
      &lt; Last_Name&gt;G&lt;/ Last_Name&gt;
      &lt; Employee_Status_Date&gt;2013-10-04-07:00&lt;/ Employee_Status_Date&gt;
      &lt; PayrollResults&gt;
          &lt; DepoDt&gt;2016-01-08-08:00&lt;/ DepoDt&gt;
          &lt; FSA_Dep_Contributions&gt;48.08&lt;/ FSA_Dep_Contributions&gt;
          &lt; FSA_Limitd_Contributions&gt;0&lt;/ FSA_Limitd_Contributions&gt;
          &lt; FSA_Med_Contributions&gt;0&lt;/ FSA_Med_Contributions&gt;
      &lt;/ PayrollResults&gt;
  &lt;/ Report_Entry&gt;
  &lt; Report_Entry&gt;
      &lt; FileDateTime&gt;2016-01-05T22:45:55.692-08:00&lt;/ FileDateTime&gt;
      &lt; CurrentYear&gt;2016&lt;/ CurrentYear&gt;
      &lt; MemNum&gt;205767&lt;/ MemNum&gt;
      &lt; SSN&gt;777777&lt;/ SSN&gt;
      &lt; First_Name&gt;R&lt;/ First_Name&gt;
      &lt; Last_Name&gt;Ks&lt;/ Last_Name&gt;
      &lt; PayrollResults&gt;
          &lt; DepoDt&gt;2016-01-08-08:00&lt;/ DepoDt&gt;
          &lt; FSA_Dep_Contributions&gt;0&lt;/ FSA_Dep_Contributions&gt;
          &lt; FSA_Limitd_Contributions&gt;0&lt;/ FSA_Limitd_Contributions&gt;
          &lt; FSA_Med_Contributions&gt;28.85&lt;/ FSA_Med_Contributions&gt;
      &lt;/ PayrollResults&gt;
  &lt;/ Report_Entry&gt;
  </code></pre>
  
  <p>
  My xslt is producing a text file and is counting the number of rows in the output file. The file in output rows will be produced only if any of the contribution is greater than zero from the above xml. I have used the below code but its outputting 3  whereas it should output only 2. Please let me know what am I doing worng in my code.</p>
  
  <p>I am using this :</p>
  
  <pre><code>&lt;xsl:variable name="recordCount"&gt;
    &lt;xsl:value-of select=" 
      count( Report_Data/ Report_Entry/ PayrollResults[last()]/ FSA_Dep_Contributions != 0) +
      count( Report_Data/ Report_Entry/ PayrollResults[last()]/ FSA_Limitd_Contributions != 0) +
      count( Report_Data/ Report_Entry/ PayrollResults[last()]/ FSA_Med_Contributions != 0)"/&gt; 
  &lt;/xsl:variable&gt;
  &lt;xsl:value-of select="substring(concat($recordCount)"/&gt;
  </code></pre>