[Home] [By Thread] [By Date] [Recent Entries]
On 10/04/2014 12:44, David Rudel wrote:
After I wrote that post I realized that, in some sense, I might be asking the wrong question... Might one claim that if I'm still talking about "state variables" and the like that I'm not really embracing the declarative paradigm anyway? Well quite I was going to ask what you mean by "declarative/non-declarative and "updating state variables" in an XSLT system. Perhaps I should be asking myself "How do I do the analysis I want to do without resorting to a subsystem of triggers and state functions?" I'd do something like something (untested) <xsl:variable name="sids" select="31,35"/> <xsl:variable name="a" select="(item[1],item[@id=$sids][1])[last()]"/> <xsl:variable name="b" select="(item[last()],item[@id=$sids][last()])[last()]"/> <xsl:variable name="s" select="$a|item[$a<<.][.<<$b]|$b"/> no of items <xsl:value-of select="count($s)"/> no of specials <xsl:value-of select="count($s[@id=$sids])/> avg <xsl:value of select="sum($s/@value) div count($s)"/> I'm not sure what part you'd consider to be "triggers" or "state variables" David
|

Cart



