title: Standard Deviation on xslt 1.0
body: <p>Good morning everyone,
  i,m trying to calculate the standard deviation, but still getting error (this value is not a node-set : <code>&lt;xsl:value-of select="sum(math:power(sum(playerweeklysalary - $the_avg), 2))"/&gt;</code>  ).
  I,m using the math functions in xmlns:math="http://exslt.org/math" . Any other possibility to do that is also welcome.
  Could anybody help me by ...
  I thank in advance for any answear !</p>
  
  <p>here is how the xml looks like:</p>
  
  <pre><code> &lt;players_db&gt;
      &lt;players&gt;
      &lt;player&gt;
      &lt;playerbasicinfos&gt;
      &lt;playerweeklysalary&gt;2&lt;/playerweeklysalary&gt;
      &lt;/playerbasicinfos&gt;
      &lt;/player&gt;
      &lt;player&gt;
      &lt;playerbasicinfos&gt;
      &lt;playerweeklysalary&gt;10&lt;/playerweeklysalary&gt;
      &lt;/playerbasicinfos&gt;
      &lt;/player&gt;
      &lt;player&gt;
      &lt;playerbasicinfos&gt;
      &lt;playerweeklysalary&gt;3&lt;/playerweeklysalary&gt;
      &lt;/playerbasicinfos&gt;
      &lt;/player&gt;
      &lt;player&gt;
      &lt;playerbasicinfos&gt;
      &lt;playerweeklysalary&gt;6&lt;/playerweeklysalary&gt;
      &lt;/playerbasicinfos&gt;
      &lt;/player&gt;
      &lt;/players&gt;
      &lt;/players_db&gt;
  </code></pre>
  
  <p>here the xslt 1.0 code snipped:</p>
  
  <pre><code>&lt;xsl:variable name="count_players_1"&gt;
              &lt;xsl:value-of select="count(/players_db/players/player)-1"/&gt;
          &lt;/xsl:variable&gt;
  
          &lt;xsl:variable name="the_avg"&gt;
              &lt;xsl:value-of select="sum(/players_db/players/player/playerbasicinfos/playerweeklysalary) div count(/players_db/players/player)"/&gt;
          &lt;/xsl:variable&gt;
  
          &lt;xsl:variable name="power2_sum_diff"&gt;
              &lt;xsl:for-each select="/players_db/players/player/playerbasicinfos"&gt;
                  &lt;xsl:value-of select="sum(math:power(sum(playerweeklysalary - $the_avg), 2))"/&gt;
              &lt;/xsl:for-each&gt;
          &lt;/xsl:variable&gt;
  
          &lt;xsl:variable name="sqrt_all"&gt;
              &lt;xsl:value-of select="math:sqrt($power2_sum_diff div $count_players_1)"/&gt;
          &lt;/xsl:variable&gt;
          &lt;xsl:text&gt;Deviation here: &lt;/xsl:text&gt; &lt;xsl:value-of select="$sqrt_all"/&gt;
  </code></pre>