Hi,
You don't need variables here, just use position() function.
Assuming that the source XML is
Code:
<parent><child>jack</child><child>jill</child><child>joe</child></parent>
two main templates are:
Code:
<xsl:template match="parent">
<table>
<xsl:apply-templates select="*"/>
</table>
</xsl:template>
<xsl:template match="child">
<xsl:if test="position() = 1">
<tr>
<td>IVE GOT CHILDREN!</td>
</tr>
</xsl:if>
<tr>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:template>
Although I would prefer to put the header in the "parenet" template body:
Code:
<xsl:template match="parent">
<table>
<tr>
<td>IVE GOT CHILDREN!</td>
</tr>
<xsl:apply-templates select="*"/>
</table>
</xsl:template>
<xsl:template match="child">
<tr>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:template>
Regards,
Armen