Re: [xsl] Easy question, big headache.

Subject: Re: [xsl] Easy question, big headache.
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Tue, 11 Mar 2008 12:32:57 +0530
On 3/11/08, Patrick Bergeron <pbergeron@xxxxxxxxxxx> wrote:
> In any other language, it's easy easy:
>
> If (yes_output_record)
> {
>   count = count + 1;
>
>   if (count modulo 5 = zero)
>      output_marker();
>
>   output_record();
> }

In XSLT, this might be accomplished as follows:

Suppose $list holds your output list. Then ...

Marker
<xsl:for-each select="$list">
    <xsl:copy-of select="." />
    <xsl:if test="(position() mod 5) = 0">
       Marker
    </xsl:if>
</xsl:for-each>

(This is not tested)


-- 
Regards,
Mukul Gandhi

Current Thread