The code below puts each item in a float:left DIV. After each 3rd DIV it needs to clear the previous 3 DIVs and start a new row. The code below works, but it requires that I edit a 'column' element in my XML file. Every 3rd item in my XML file has a <column>3</column> element added to it so the xsl:if test code knows when to add my clearing DIV.
This seems inefficient to me and I'm sure there is a way the XSLT processor can insert my <div class="cleardiv "/> after each 3rd item. Any ideas?
This seems inefficient to me and I'm sure there is a way the XSLT processor can insert my <div class="cleardiv "/> after each 3rd item. Any ideas?
Code:
<xsl:template match="item">
<div class="leftcolumn33">
<!--Display Title and Description-->
<h2><xsl:value-of select="title"/></h2>
<p><xsl:copy-of select="description/node()"/></p>
<!--END Display-->
</div> <!--End leftcolumn33 div-->
<!--Test if the value in 'column' element is 3. If so, add a 'cleardiv'-->
<xsl:if test="column ='3'">
<div class="cleardiv"/>
</xsl:if>
<!--END Test-->
</xsl:template>
Comment