Re: Alternating table row colors with recursion

Subject: Re: Alternating table row colors with recursion
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 28 Nov 2000 19:23:39 GMT
> I think he wants the rows to alternate for each message.

So did I. but I thought that the input was such that each of those
selects would only pick up one message. (Without seeing the input
it's a bit hard to tell:-) 

David Carlisle wrote:
> <xsl:template match = "Message">
>  <xsl:param name="x"/>
> <tr class="{$x}">
> <td>
> </td>
> </tr>
> <xsl:apply-templates select = "//Message[ParentMessageID = '$MID']">
>   <xsl:with-param name="x">
>     <xsl:choose>
>        <xsl:when test="$x='red'>yellow</xsl:when>
>        <xsl:otherwise>red</xsl:otherwise>
>      </xsl:chose>
>   </xsl:with-param>
> </xsl:apply-templates>

$MID isn't a parameter to the template so if any instance of
select = "//Message[ParentMessageID = '$MID']">
selects more than one message, then the output will be rather strange
as you'll get a tr row for each message but after each one
an identical set of nodes would be processed by the apply-templates.

My solution was based on this observation leading me to assume
that the input was rather restricted.

If not then the whole thing is probably wrong, but in that case Ithink
we need more info about what the input does look like.


This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit

 XSL-List info and archive:

Current Thread