Thursday, July 3, 2008

Item Template added to interate all Nodes

Add to the bottom of:Style Library/XSL Style Sheets/ItemStyle.xsl

<xsl:template name="ShowRaw" match="Row[@Style='ShowRaw']" mode="itemstyle">
<xsl:for-each select="@*">
<p><strong>Name:</strong> <xsl:value-of select="name()" /> <strong>Value:</strong><xsl:value-of select="." /></p>
</xsl:for-each>
</xsl:template>


A better one:


<xsl:template name="ShowRaw" match="Row[@Style='ShowRaw']" mode="itemstyle">
<table style="border:1px silver solid;">
<xsl:for-each select="@*">
<tr>
<xsl:if test="position() mod 2 != 1">
<xsl:attribute name="style">background-color:#dddddd</xsl:attribute>
</xsl:if>
<td style="border:1px silver solid;">
<xsl:value-of select="name()" />
</td>
<td style="border:1px silver solid;">
<xsl:value-of select="." />
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>

No comments: