To get the subtotal of products in their own subcategory
<
xsl:template mode =”do-sum” match=”Products”>
<xsl:param name=”sum” select=”0″/>
<xsl:variable name=”running-sum” select=”number(translate($sum + number(number(Product_Verkoopbasis)*number(Product_Voorraad)),’.',”))”/>
<xsl:choose>
<xsl:when test=”following-sibling::Products”>
<xsl:apply-templates mode=”do-sum” select=”following-sibling::Products[1]“>
<xsl:with-param name=”sum” select=”$running-sum”/>
xsl:apply-templates>
xsl:when>
<xsl:otherwise>
<xsl:value-of select=”format-number( $running-sum, ‘#.##0,00′, ‘numfrmt’)”/>
xsl:otherwise>
xsl:choose>
xsl:template>
<xsl:template name=”getSubtotal”>
<fo:table-row>
<fo:table-cell background-color=”#CCCCCC” number-columns-spanned=”3″>fo:table-cell>
<fo:table-cell background-color=”#CCCCCC” text-align=”right”>
<fo:block>Subtotal :fo:block>
fo:table-cell>
<fo:table-cell background-color=”#CCCCCC” text-align=”right”>
<fo:block>
<xsl:apply-templates mode=”do-sum” select=”SubCategory[1]/Products[1]“/> €
fo:block>
fo:table-cell>
fo:table-row>
xsl:template>

