Subject: [xsl] Sum a group of transactions, and determne debit or credit From: kakridge@xxxxxxxxxxxxx Date: Tue, 16 Dec 2003 21:09:41 -0500 |
I've looked countless places for this answer, so I thought I'd throw it out to the experts. I truly appreciate any advice. I basically have a listing of transaction that are unsorted. I need to sort by an account code, then give a total of debits and credits on each account code, then a final total of debits in credits. Right now, I am able to break between each account code, but I'm having trouble summating the totals. Sample XML: <ArrayOfAccountLineItem xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <AccountLineItem> <Name>Base Price</Name> <Amount>90</Amount> <GLAccountNumber>P3-325-23114-5223-33181</GLAccountNumber> </AccountLineItem> <AccountLineItem> <Name>Base Price</Name> <Amount>20</Amount> <GLAccountNumber>P3-325-23114-5246-33181</GLAccountNumber> </AccountLineItem> <AccountLineItem> <Name>Equipment Rental Price if Age < 18</Name> <Amount>9</Amount> <GLAccountNumber>P3-325-23114-5408-33181</GLAccountNumber> </AccountLineItem> <AccountLineItem> <Name>Resident Discount</Name> <Amount>-5</Amount> <GLAccountNumber>P3-325-23114-5500-33181</GLAccountNumber> </AccountLineItem> </ ArrayOfAccountLineItem> Sample XSL: <xsl:template match="ArrayOfAccountLineItem"> <xsl:for-each select="AccountLineItem"> <xsl:sort select="GLAccountNumber"/> <xsl:if test="position() > 1"> <xsl:choose> <xsl:when test="not(./GLAccountNumber = preceding::GLAccountNumber) "> --->IN THIS CASE, I NEED TO BREAK, AND PRINT THE SUM OF CREDITS(Amount > 0) AND THE SUM OF DEBITS(Amount < 0) for all AccountLineItems/Amounts that have the GLAccountNumber = preceding::GLAccountNumber <close tags...> Any help is greatly, greatly appreciated. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Complex (i think) xpath m, Wendell Piez | Thread | [xsl] Re: Sum a group of transactio, Dimitre Novatchev |
RE: [xsl] Generating XML fragment t, Josh Canfield | Date | [xsl] Re: Getting a distinct list o, Dimitre Novatchev |
Month |