This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Disable Output Escaping - really useful




> -----Original Message-----
>>In the template for loosegrids below, 5 items are put in each row. 
> When an item is the 5th, 10th, 15th etc. (using "position() mod 5 =0") it 
> should close this row and start the next
> Anyone know a way of doing this without 
> disable-output-escaping? Is using
> disable-output-escaping like this a bit of a hack?
> 
Yes, it's a horrible hack. I posted the following solution a while back:

<xsl:for-each select="item[position() mod 5 = 0]
<tr>
<td><xsl:value-of select="."/></td>
<td><xsl:value-of select="following-sibling::item[1]"/></td>
<td><xsl:value-of select="following-sibling::item[2]"/></td>
<td><xsl:value-of select="following-sibling::item[3]"/></td>
<td><xsl:value-of select="following-sibling::item[4]"/></td>
</tr>
</xsl:for-each>

There are other solutions involving recursive templates.

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]