title: use of accumulator in xslt 3.0 not working as I need
body: <p>I have an XML in which I have a list of books with properties like title, price, author, additional price, artist, country etc.  XML is as below.</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;catalog&gt;
    &lt;cd&gt;
      &lt;title&gt;Empire Burlesque&lt;/title&gt;
      &lt;artist&gt;Bob Dylan&lt;/artist&gt;
      &lt;country&gt;USA&lt;/country&gt;
      &lt;company&gt;Columbia&lt;/company&gt;
      &lt;price&gt;10.90&lt;/price&gt;
      &lt;additionalprice&gt;12.90&lt;/additionalprice&gt;
      &lt;year&gt;1985&lt;/year&gt;
    &lt;/cd&gt;
    &lt;cd&gt;
      &lt;title&gt;Hide your heart&lt;/title&gt;
      &lt;artist&gt;Bonnie Tyler&lt;/artist&gt;
      &lt;country&gt;UK&lt;/country&gt;
      &lt;company&gt;CBS Records&lt;/company&gt;
      &lt;price&gt;9.90&lt;/price&gt;
      &lt;additionalprice&gt;10.90&lt;/additionalprice&gt;
      &lt;year&gt;1988&lt;/year&gt;
    &lt;/cd&gt;
  </code></pre>
  
  <p>and so on</p>
  
  <p>I want to write an XSLT 3.0 applied on XML to get an HTML. I want to use an accumulator to get a total number of books in the catalog. Although there are better methods, I just wanted to use accumulator for practicing purposes and print the total at the end of the table containing books where columns are title, author and total price. For filling title and author, I used for-each. Total price=price+ additionalPrice. I want to use iterate for filing the total price. Can anybody please help me with this. My incomplete stylesheet looks like the below:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="3.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:template match="/"&gt;
  &lt;html&gt; 
  &lt;body&gt;
    &lt;h2&gt;My CD Collection&lt;/h2&gt;
    &lt;table border="2"&gt;
      &lt;tr bgcolor="#9acd32"&gt;
         &lt;th style="text-align:left"&gt;Title&lt;/th&gt;
         &lt;th style="text-align:left"&gt;Artist&lt;/th&gt;
         &lt;th style="text-align:left"&gt;Total Price&lt;/th&gt;
      &lt;/tr&gt;
   &lt;xsl:accumulator name="total" as="xs:integer" initial-value="0" streamable="no"&gt;
      &lt;xsl:accumulator-rule match="title" select="$value+1"/&gt;
   &lt;/xsl:accumulator&gt;
      &lt;xsl:for-each select="catalog/cd"&gt;
       &lt;tr&gt;
         &lt;td&gt;&lt;xsl:value-of select="title"/&gt;&lt;/td&gt;
         &lt;td&gt;&lt;xsl:value-of select="artist"/&gt;&lt;/td&gt;
       &lt;/tr&gt;
     &lt;/xsl:for-each&gt;
           &lt;tr bgcolor="#FFA500"&gt;
             &lt;td&gt; Total number of Books &lt;/td&gt;
             &lt;td&gt; &lt;xsl:value-of select="accumulator-before('total')"/&lt;/td&gt;
           &lt;/tr&gt;
       &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I don't want to use streaming.</p>