Subject: RE: [xsl] summing up incrementally From: kakridge@xxxxxxxxxxxxx Date: Fri, 19 Dec 2003 02:47:25 -0500 |
This doesn't apply to just interest- it applies to any annualized growth calculations. Suppose sales in December 1933 is $100. Over the next 4 years sales grow at 10% anually. Total growth from 1933 to 1937 is not 40%. The formula for total growth would be: (((((P * I)I)I)I) where P is original amount and I is growth. This is the same as 100(1+.1)^4 = 146.41, not 140. -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Paul Tremblay Sent: Friday, December 19, 2003 12:27 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] summing up incrementally On Fri, Dec 19, 2003 at 12:23:34AM +0000, David Carlisle wrote: > > that would just be <xsl:value-of select="sum(preceding-sibling::year/month[@month='December']/@percentage -increase)"/> Yes, that works nicely. I need to really see how sum works. The book I mainly use (*XSLT Quickly*) gives about 1/2 a page to sum, so I didn't know you could use it this way. > > But it sounds like you want a product, not a sum???? > > cumulative interest isn't additive > The increase over three years is 1.03 * 1.02 * 1.08 =~ 1.135 or 13.5% > so you will need a recursive template as xpath2 doesn't have a product > built in (or you could use saxon7's implementation of xpath 2 draft, > which does) Actually, I am not working with interest on a loan. I am working with the gross sales of chain stores. Each month in December the statistics give the percentage of increase from the previous year. So if in 1934 the store increased its sales 5 percent, and then in 1935 increased it 7 percent, the total increase from 1933 is 12 percent. I'm using the percent from a periodical, but I don't think the periodical adjusted for inflation, so I may have to do some additional math. But I get the idea of sum--thanks! Paul -- ************************ *Paul Tremblay * *phthenry@xxxxxxxxxxxxx* ************************ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Re: summing up incrementa, kakridge | Thread | Re: [xsl] summing up incrementally, David Carlisle |
[xsl] Re: pretty-printing XML into , Dimitre Novatchev | Date | Re: [xsl] Why template match differ, Rakesh |
Month |