[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Muenchian grouping and summing - Need to see individua

Subject: Muenchian grouping and summing - Need to see individual lines and summed lines
From: "Belcher, Aziza" <Aziza.Belcher@xxxxxx>
Date: Fri, 24 Mar 2006 14:17:36 -0500
aziza belcher
I found this other post
(http://www.stylusstudio.com/xsllist/200312/post80710.html) and it was very
helpful in getting the sum to work. What I'm trying to achieve now is:
Acct A 3000 BAL
Acct A 4000 BAL
Acct A 5000 BAL
Acct A 12000 TOTAL
Acct B 1000 BAL
Acct B 2000 BAL
Acct B 3000 TOTAL

However, it seems to be looping around too often and giving me duplicate
results. Below is my stylesheet, the input for the entry template is the
result set from a sproc.
Thanks in advance, AB

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes"/>

        <xsl:param name="date"/>
        <xsl:param name="fileHeader"/>
        <xsl:param name="columnHeader"/>
        <xsl:param name="fileTrailer"/>

<xsl:key name="kAccByNum" match="entry" use="AccountNumber"/>

<xsl:template match="/">
	<xsl:apply-templates select="result"/>
</xsl:template>

<xsl:template match="result">
	<xsl:if test="$fileHeader='Y'">
	<xsl:call-template name="header"/>
</xsl:if>
	<xsl:if test="$columnHeader='Y'">
	<xsl:call-template name="columnheader"/>
</xsl:if>
	<xsl:apply-templates select="entry"/>
<xsl:if test="$fileTrailer='Y'">
	<xsl:call-template name="trailer"/>
</xsl:if>
</xsl:template>

<xsl:template name="header">
</xsl:template>

<xsl:template name="columnheader">
	<xsl:text>Date,Account Number,Account
Type,Currency,Balance</xsl:text>
	<xsl:text>&#10;</xsl:text>
</xsl:template>

<xsl:template match="entry">
	<xsl:choose>
	<xsl:when test="EndingAcctBalanceLocal = 0.0 and
EndingAcctBalanceBase = 0.0">
	</xsl:when>

	<xsl:otherwise>
                                <xsl:value-of
select="StatementDate"/><xsl:text>,</xsl:text>
                                <xsl:value-of
select="AccountNumber"/><xsl:text>-</xsl:text>
                                <xsl:value-of
select="AccountBalanceCurrency"/> <xsl:text>,</xsl:text>
                                <xsl:value-of
select="AccountBalanceCurrency"/><xsl:text>,</xsl:text>
                                <xsl:value-of
select="EndingAcctBalanceLocal"/><xsl:text>,</xsl:text>
                                <xsl:text>&#10;</xsl:text> <!-- End of Row
-->


	</xsl:otherwise>
<xsl:for-each select="/*/*[generate-id() =
generate-id(key('kAccByNum',AccountNumber)[1])]">
<xsl:variable name="date" select="StatementDate"/>
<xsl:variable name="acct" select="AccountNumber"/>
<xsl:variable name="basecurr" select="AccountBaseCurrency"/>
<xsl:value-of select="concat($date, ',', $acct, ',', 'Type', ',', $basecurr,
',', (sum(key('kAccByNum',AccountNumber)/EndingAcctBalanceBase)*-1),
'&#10;')"/>

	</xsl:choose>

</xsl:template>

<xsl:template name="trailer">
</xsl:template>

</xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.