xsl-list
[Top] [All Lists]

how to create sub-totals and carry-overs

2003-06-26 02:44:00
i have to sum up special amounts and show sub-totals
on the bottom of a page, and carry-overs at the top of
the following page.
i use markers for this.
code for creating the subtotals looks like this:

<fo:marker marker-class-name="subtotalvalue">
        <xsl:call-template name="calculate">
        <xsl:with-param name="text">Zwischensumme</xsl:with-param>
        <xsl:with-param name="mode">1</xsl:with-param>
        <xsl:with-param name="amount">
        <xsl:choose>
                <xsl:when test="AmountISH!='' and
starts-with(@SubcodeISH,'A')">
                <xsl:value-of select="AmountISH + sum
(preceding::AmountISH[.!= '' and starts-with(../@SubcodeISH,'A')])"/>
                </xsl:when>
                <xsl:otherwise> 
                <xsl:value-of select="sum(preceding::AmountISH[.!= '' and
starts-with(../@SubcodeISH,'A')])"/>
                </xsl:otherwise>
        </xsl:choose>
        </xsl:with-param>
        <xsl:with-param name="currency" select="CurrencyISH"/>
        </xsl:call-template>
</fo:marker>

the disadvantage of this construction is that for each (!) position
(table-row) all the preceding AmountISH nodes
are processed. same again for creating the carry-overs.
when i have a document with 10000 amount positions, this doesn't make sense
to me.
do you have a better idea to do the (partial) summing up ?

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>