<xsl:template name="COMPARE">
<table width="100%" border="0" cellspacing="1"
cellpadding="2">
<xsl:for-each select="//ITEM_CMP[1]/descendant::*[not(child::*)]">
<tr id="{position()}" name="{name()}">
<xsl:choose>
<xsl:when test="position() mod 2">
<xsl:attribute name="bgcolor"><xsl:text></xsl:text></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="bgcolor"><xsl:text>#F0F0F0</xsl:text></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="name()='CONTROL'">
<td class="verd_10n"><strong><font
color="#FF0000"> Оставить</font></strong></td>
</xsl:when>
<xsl:when test="name()='IMAGE'">
<td> </td>
</xsl:when>
<xsl:when test="name()='FULLNAME'">
<td><strong>Наименование</strong></td>
</xsl:when>
<xsl:when test="name()='SPECIFICATION'">
<td> </td>
</xsl:when>
<xsl:when test="name()='VENDOR'">
<td><strong>Производитель</strong></td>
</xsl:when>
<xsl:when test="name()='PRICE'">
<td><strong>Цена</strong></td>
</xsl:when>
<xsl:when test="name()='VALUE'">
<td><b><xsl:value-of select="parent::*/KEY" /></b></td>
</xsl:when>
<xsl:otherwise>
<td class="verd_10n"><strong><xsl:value-of select="name()" /></strong></td>
</xsl:otherwise>
</xsl:choose>
<!-- position() вместо name() так как есть одинаковые имена см. sux выше -->
<xsl:variable name="f" select="position()"/>
<xsl:variable name="fname" select="name()"/>
<xsl:for-each select="//ITEM_CMP/descendant::*[not(child::*)][position()=$f]">
<xsl:choose>
<xsl:when test="$fname='CONTROL'">
<td align="center">
<input type="checkbox" name="cb_compare[]" value="{../@id}" />
</td>
</xsl:when>
<xsl:when test="$fname='IMAGE'">
<td align="center">
<IMG SRC="img/{@id}{@ext}" />
</td>
</xsl:when>
<xsl:otherwise>
<td align="center"> <xsl:value-of select="."/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:template>