Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Help - Generate N x 2 html table [Thread Next] Re: Help - Generate N x 2 html tableTo: NULL Date: 1/3/2006 4:50:00 PM cardinallijr wrote:
> What can I do to have not to repeat the XSL Code for the first node
> and again for the following node ? Is there a way to do it ?
>
Not sure what you mean, but when the template you want to apply contains the
contents for a single row, you could do:
<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>
<xsl:call-template name="generate-row" />
</tr>
</xsl:template>
<xsl:template name="generate-row">
<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>
</xsl:template>
JW
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
