Subject: [xsl] 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 |
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> </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> </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), ' ')"/> </xsl:choose> </xsl:template> <xsl:template name="trailer"> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Target Namespace in XML b, Michael Kay | Thread | [xsl] IE applies transformation, Fx, Manfred Staudinger |
RE: [xsl] Conditional statements in, cknell | Date | Re: [xsl] wordml to xml with pStyle, G. Ken Holman |
Month |