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

Sum a group of transactions, and determne debit or cre

Subject: Sum a group of transactions, and determne debit or credit
From: kakridge@xxxxxxxxxxxxx
Date: Tue, 16 Dec 2003 21:09:41 -0500
xsl sum group
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 &lt; 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() &gt; 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

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.