Josh Campbell wrote:
I've got a column of numbers being pulled out of XML that I want to total at the bottom of the page using the XSL.
I don't know how many rows of figures will be generated so need something that can just take all the values in a column and add them up
Check out the sum() function:
 http://www.w3.org/TR/xpath#section-Number-Functions
If your XML is something like this
 <records>
   <record>
     <name>foo</name><price>99.0</price>
   <record>
   </record>
     <name>bar</name><price>100.0</price>
   </record>
 </records>
use it like
  <xsl:template match="records">
    <xsl:text>Total: </xsl:text>
    <xsl:value-of select="sum(record/price)"/>
  </xsl:template>
If your problem is more complicated, ask on the XSL list
(http://www.mulberrytech.com/xsl/xsl-list/), because you
have an XSLT problem rather than a FOP problem. Provide
some more details: a relevant snippet of your XML, and how
to derive the "total" you are after. If your computation
involves something like price*quantity per record, look
into the list archives first.

J.Pietschmann




Reply via email to