Wednesday, June 17, 2009

Alternate Styling

Want to make alternate styling in a DataViewWebPart or ContentQueryWebPart? Here is the way:

<tr>
    <xsl:if test="position() mod 2 = 0">
        <xsl:attribute name="class">AlternatingClass</xsl:attribute>
    </xsl:if>

    <td ...>
    ...
</tr>

Where AlternatingClass: is the alternating class name that will be the value of the class attribute of the TR tag.

No comments: