Subject: Re: [xsl] Re: Keeping a running total? From: Andrew Franz <afranz0@xxxxxxxxxxxxxxxx> Date: Thu, 13 Jul 2006 22:50:50 +1000 |
On 7/12/06, Andrew Franz <afranz0@xxxxxxxxxxxxxxxx> wrote:I suppose a general solution would have a list of quotas (and a corresponding list of quota names), e.g. :
Okay, assuming the following input:
<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>
O(N) algorithm using recursion (not tested):
Good!
I was able to make it work after a few corrections.
What about having a bigger than 2 (variable) number of quotas? How would your solution change to tackle this?
<xsl:template match="xml"> <xsl:apply-templates select="factory"> <xsl:with-param name="left0" select="$Widget_quota" /> <xsl:with-param name="left1" select="$Gadget_quota" /> ... <xsl:with-param name="name0">Widget</xsl:with-param> <xsl:with-param name="name1">Gadget</xsl:with-param> ... </xsl:apply-templates> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: Keeping a running tot, Dimitre Novatchev | Thread | Re: [xsl] Re: Keeping a running tot, Dimitre Novatchev |
Re: [xsl] Outputting a complete sch, Eric Bréchemier | Date | [xsl] XSL hold, compare, and replac, Steve Sze |
Month |