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

RE: Transactions on Inventory

Subject: RE: Transactions on Inventory
From: Jarno.Elovirta@xxxxxxxxx
Date: Mon, 1 Mar 2004 08:57:40 +0200
transactions on inventory

> Desired Output:
> date oper qty cumulative
> 1/1/04 set 100 100
> 1/2/04 add 50 150
> 1/3/04 sub 100 50
> 1/4/04 set 40 40
> 1/5/04 sub 10 30
> 1/6/04 add 30 30
> The <item>'s may or may not be ordered by increasing date.
> Does anyone have an idea what the best approach to tackling 
> this problem is?
> This is a grouping problem but I am not doing just one 
> operation like a running
> sum. The number that shows up in the cumulative column could 
> be the results of
> setting, adding or subtracting from prior inventory level.
> I would prefer a solution that did not use extension 
> functions or libraries as
> this statement of the problem is a implification of the 
> larger problem that I
> am tackling (multiple inventory items, categories of 
> inventory etc). The XSLT
> has to work in IE6.

Just IE6? The easiest in that case would be to first make a copy of the input tree with items ordered by date (see the FAQ for ordering by various date formats), cast the RTF into a node-set by using the extension function provided by MSXML, then write recursive template that starts from the first and goes throught the list, outputting the table rows and calculating the cumulative quantity. If you absolutely don't want to use extensions, either go with the two pass solution of first sorting, then processing; there are one pass, pure XSLT 1.0 solutions, but using the node-set extension makes your life easier.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.