[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]



<xsl:variable name="seq" select="<<find the items I need to process>>"/>

<xsl:apply-templates select="$seq" mode="analyze">
(: put a bunch of with-param elements in here to control counters and
triggers and anything you need to control the analysis :)
</xsl:apply-templates>

<xsl:template mode="analyze">
(: pick up parameters:)
(: modify the state variables and triggers:)

<xsl:if test="position() = last()">
(: output results here :)
</xsl:if>
</xsl:template>

Another method would be to use a recursive function on a sequence:

<xsl:function name="mynamespace:analyze">
<xsl:param name="seq" as="item()*">
(:several other parameters to control analysis: counters, triggers,
state variables, etc.:)

<xsl:choose>
<xsl:when test="empty($seq)">
(:output data :)
</xsl:when>
<xsl:otherwise>
(: Modify counters, triggers, and state variables based on their
current values and head($seq))
<xsl:sequence select="mynamespace:analyze(tail($seq), (: new state
variables and counters:))/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>

I was wondering what experienced users did in these cases and if
either of the above is wrong-headed.
-David

-- 

"A false conclusion, once arrived at and widely accepted is not
dislodged easily, and the less it is understood, the more tenaciously
it is held." - Cantor's Law of Preservation of Ignorance.


Current Thread