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

Re: Keeping a running total? (Redo)

Subject: Re: Keeping a running total? (Redo)
From: didoss@xxxxxxxxxxx
Date: Tue, 11 Jul 2006 21:01:50 +0000
subtract list from total
I would think that the intended output would be:

Factory A produces 3 widgets;
Factory B produces 5 widgets and 1 gadget;
Factory C produces 3 gadgets;
Factory D produces 1 gadget and 1 excess product - whatever that is;
Factory E and beyond produce excess products.

So, you are really trying to keep track of 2 changing numbers,...the number of current product still required, as well as the capacity of the factory.  When the number of the current product required gets to zero, you change products - gotta figure out how to prioritize those.  When the capacity of the current factory gets to zero (has been fully allocated), you change factories - which would be controlled by the order of the input xml, I assume.

So, is it better to do this incrementally - subtract one from required and one from remaining capacity,...or to do bulk comparisons - I need to build 8, but can only build 3, so give all three to Factory 1, and subtract 3 from WidgetRequirement, then I still need to build 5, but Factory B can build 6, so subtract all 5 from the WidgetRequirement and the CurrentCapacity and then figure out what to do with the remaining CurrentCapacity for Factory B.


Dianne

 -------------- Original message ----------------------
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
> The presented source xml file is not too representative because the
> total capacity of the first two factories is exactly the widget quota.
> 
> What should be the output in case the capacity for factory B was 6?
> 
> 
> On 7/11/06, Steve <subsume@xxxxxxxxx> wrote:
> > Previous thread has degenerated into confusion. Let's try again.
> >
> > ----- Source XML
> > <xml>
> >  <factory x="A" capacity = "3" />
> >  <factory x="B" capacity= "5" />
> >   <factory x="C" capacity = "3" />
> >   <factory x="D" capacity = "2" />
> >   <factory x="E" capacity = "2" />
> >   ...etc...
> > </xml>
> >
> > $Widget_quota = "8"
> > $Gadget_quota = "5"
> >
> > ----- Goal: an output table like below.
> >
> > Factory    |   Widgets  |  Gadgets    |      Excess
> >
> >     A        |   3
> >     B        |   5
> > <!--          *Click. Widget Quota has been reached. Switch to gadgets* -->
> >     C        |                       3
> >     D        |                       2
> >  <!--          *Click. Omg. Gadget Quota has been reached. Switch to Excess* 
> -->
> >     E         |                                             etc.
> >     F         |                                             etc.
> >     G         |                                             etc.
> >     H         |                                             etc.
> >
> > ----
> > Howto?
> >
> > M.K. Suggested
> > http://www.biglist.com/lists/xsl-list/archives/200607/msg00191.html
> > but my question (Howto?) remains.
> >
> > Thanks,
> >
> > -Steve
> >
> >
> 
> 
> -- 
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> Truly great madness cannot be achieved without significant intelligence.

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.