Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Help - Generate N x 2 html table >Thread Next - Re: Help - Generate N x 2 html table Re: Help - Generate N x 2 html tableTo: NULL Date: 1/2/2006 11:10:00 PM cardinallijr wrote:
> What I want to do is to generate a HTML table with N rows(depending of
> the number of elements) and 2 columns(2
> products) for each row. For example:
[...]
> I've tried a lot of ways to do it with a XSL but couldn't get this to
> work.
> Please, Do you have an idea ?
>
Here's one of many ways to do this:
<xsl:template match="root">
<table>
<xsl:apply-templates
select="products/product[position() mod 2 != 0]" />
</table>
</xsl:template>
<xsl:template match="products/product[position() mod 2 != 0]">
<tr>
<td>Product <xsl:value-of select="id" /></td>
<xsl:if test="following-sibling::*">
<td>Product <xsl:value-of select="following-sibling::*/id" /></td>
</xsl:if>
</tr>
</xsl:template>
JW
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
