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

Transactions on Inventory

Subject: Transactions on Inventory
From: Dan Diebolt <dandiebolt@xxxxxxxxx>
Date: Sun, 29 Feb 2004 18:56:53 -0800 (PST)
transactions in inventory
I have source XML that models a series of transactions on a single item of
inventory (set inventory, add to inventory or subtract from inventory) and
looks like this:

Input:
<root>
 <item>
  <date>1/1/04</date>
  <oper>set   </oper>
  <qnty>100   </qnty>
 </item>
 <item>
  <date>1/2/04</date>
  <oper>add   </oper>
  <qnty>50    </qnty>
 </item>
 <item>
  <date>1/3/04</date>
  <oper>sub   </oper>
  <qnty>100   </qnty>
 </item>
 <item>
  <date>1/4/04</date>
  <oper>set   </oper>
  <qnty>40    </qnty>
 </item>
 <item>
  <date>1/5/04</date>
  <oper>sub   </oper>
  <qnty>10    </qnty>
 </item>
 <item>
  <date>1/6/04</date>
  <oper>add   </oper>
  <qnty>30    </qnty>
 </item>
</root>

The <oper> tag represents the operation performed on the inventory:

set - sets the quantity on the inventory as if an audit was done to establish
determine the explicit amount of inventory on hand
add - receives the quantity of new inventory into stock
sub - disburses the quantity of existing inventory from stock

The desired output is an HTML table with the following column layout:

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.
 
Thanks for any help you can provide. A copy of any response to
dandiebolt@xxxxxxxxx would be appreciated as I am on digest. 


 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.