RE: Totals

Hi,

> I want to group and sub-total based on a SBU - Strategic Business Unit:
[snip]
> There are 4 different SBU's and I want to sub-total at the end of each SBU.  How can I do this?

<xsl:key name="sbu" match="Customer" use="SBU" />

<xsl:template match="*[Customer]">
  <xsl:for-each select="Customer[generate-id(.) = generate-id(key('sbu', SBU))]">
    <fo:block>
      <xsl:for-each select="key('sbu', SBU)">
        <fo:block>
          <xsl:value-of select="CustomerNumber" />
        </fo:block>
        ...
      </xsl:for-each>
    </fo:block>
    <fo:block>
      <xsl:text>sub-total: </xsl:text>
      <xsl:value-of select="sum(key('sbu', SBU)/PostInc)" />
    </fo:block>
  </xsl:for-each>
</xsl:template>

XSL-List at <http://mulberrytech.com/xsl/xsl-list/> is usually a better place to ask XSLT related questions.

Cheers,

Jarno - VNV Nation: Procession

Received on Thursday, 17 April 2003 02:14:51 UTC