Subject: [xsl] Re: summing up incrementally From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx> Date: Fri, 19 Dec 2003 07:12:36 +0100 
> > 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 sumthanks! It is quite simple to see that the real comulative increase is the product of percentages of yearly increases, not their sum. E.g. two yearly increases of 50% each give 225% comulative increase. That is 1.5 x 1.5, or it may be calculated: In case the value is 100 at start, it would be 150 after year 1. An increase of 50% the second year is 50% of 150  that is 75. The value at the end of the second year is 150 + 75 = 225 Therefore, the total increase is: 225/100 = 2.25 = 225% Your approach to calculating the total increase is wrong  e.g. in the above case it woud give 100%, not 225%. Dimitre Novatchev. FXSL developer http://fxsl.sourceforge.net/  the home of FXSL Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html Dimitre Novatchev. FXSL developer http://fxsl.sourceforge.net/  the home of FXSL Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html XSLList info and archive: http://www.mulberrytech.com/xsl/xsllist
Current Thread 


< Previous  Index  Next > 

Re: [xsl] summing up incrementally, Paul Tremblay  Thread  Re: [xsl] Re: summing up incrementa, Paul Tremblay 
Re: [xsl] summing up incrementally, Paul Tremblay  Date  [xsl] Re: prettyprinting XML into , Dimitre Novatchev 
Month 