Subject: Re: [xsl] Transformation Problem (was "Help please?") From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Thu, 8 Mar 2001 09:26:30 +0000 |
Hi Yan, > I did figure out how to use position and mod together to sperates > the even from the odds, however, I can't figure out where to put the > <tr> and </tr> tag. and Unfortunately, they have to go together > somehow, but not in two different conditional loops, otherwise it > complains no close tag. The usual method of doing this kind of thing is to process only the odd cells, and have the template for those cells give the tr element and, inside it, its own value and the value of its following sibling (the even cell that goes beside it). So, rather than the xsl:for-each on all the JavaR:JDoc elements, apply it to only the odd ones: <xsl:for-each select="JavaR:JDoc[position() mod 2 = 1]"> ... </xsl:for-each> Create a row within it: <xsl:for-each select="JavaR:JDoc[position() mod 2 = 1]"> <tr> ... </tr> </xsl:for-each> And within the row, create cells for (a) the current JavaR:JDoc and (b) its following sibling: <xsl:for-each select="JavaR:JDoc[position() mod 2 = 1]"> <tr> <xsl:apply-templates select="." /> <xsl:apply-templates select="following-sibling::JavaR:JDoc" /> </tr> </xsl:for-each> You should then have a template that matches a JavaR:JDoc element and produces the cell that you want: <xsl:template match="JavaR:JDoc"> <td> ... </td> </xsl:template> I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Transformation Problem (was ", by way of B. Tommie | Thread | RE: [xsl] Converting non-numeric ch, Don Bruey |
Re: [xsl] Dynamic Index?, Jeni Tennison | Date | Re: [xsl] [exsl] EXSLT 1.0 - Common, Jeni Tennison |
Month |