<?xml version="1.0" encoding="utf-8"?>
<exslt:function xmlns:exslt="http://exslt.org/documentation" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" version="1" module="dyn" status="new">
   <exslt:name>sum</exslt:name>
   <rdf:Description ID="dyn:sum">
      <dc:subject>EXSLT</dc:subject>
      <dc:subject>dyn</dc:subject>
      <dc:subject>sum</dc:subject>
      <exslt:revision>
         <rdf:Description ID="dyn:sum.1">
            <exslt:version>1</exslt:version>
            <dc:creator rdf:parseType="Resource">
               <vcf:fn>Jeni Tennison</vcf:fn>
               <vcf:email>jeni@jenitennison.com</vcf:email>
               <vcf:url>http://www.jenitennison.com</vcf:url>
            </dc:creator>
            <dc:date>2001-11-25</dc:date>
            <dc:description>
               <html:div><!-- if you want to use DocBook, add written-in="docbook" to summary element -->
         Returns the sum of the values of a set of nodes, when their values are calculated dynamically based on an XPath expression.
      </html:div>
            </dc:description>
         </rdf:Description>
      </exslt:revision>
   </rdf:Description>
   <exslt:doc>
      <html:div><!-- if you want to use DocBook, add written-in="docbook" to documentation element -->
         <html:p>
        The <html:code>dyn:sum</html:code> function calculates the sum for the nodes passed as the first argument, where the value of each node is calculated dynamically using an XPath expression passed as a string as the second argument.
      </html:p>
         <html:p>
        The expressions are evaluated relative to the nodes passed as the first argument. In other words, the value for each node is calculated by evaluating the XPath expression with all context information being the same as that for the call to the <html:code>dyn:sum</html:code> function itself, except for the following:
      </html:p>
         <html:ul>
            <html:li>the context node is the node whose value is being calculated</html:li>
            <html:li>the context position is the position of the node within the node set passed as the first argument to the <html:code>dyn:sum</html:code> function, arranged in document order</html:li>
            <html:li>the context size is the number of nodes passed as the first argument to the <html:code>dyn:sum</html:code> function</html:li>
         </html:ul>
         <html:p>
        The <html:code>dyn:sum</html:code> function returns the sumimum of these values, calculated in exactly the same way as for <html:a href="http://www.w3.org/xpath#function-sum">
               <html:code>sum</html:code>
            </html:a>.
      </html:p>
         <html:p>
        If the expression string passed as the second argument is an invalid XPath expression (including an empty string), this function returns NaN.
      </html:p>
         <html:p>
        This function must take a second argument. To calculate the sumimum of a set of nodes based on their string values, you should use the <html:a href="http://www.w3.org/xpath#function-sum">
               <html:code>sum</html:code>
            </html:a> function.
      </html:p>
      </html:div>
   </exslt:doc>
   <exslt:definition>
      <exslt:return type="number">
         <html:div/>
      </exslt:return>
      <exslt:arg name="nodes" type="node-set" optional="no">
         <html:div/>
      </exslt:arg>
      <exslt:arg name="expression" type="string" optional="no">
         <html:div/>
      </exslt:arg>
   </exslt:definition>
   <exslt:implementations/>
   <exslt:use-cases/>
</exslt:function>
