DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

XSLT Alternating Colors For HTML Table Rows

  • submit to reddit
        This attaches a style attribute to the tr tag, but only on every other tag.

<xsl:template match="my_repeating_item">
  <xsl:if test="position() mod 2 != 1">
    <xsl:attribute  name="style">background-color:#dddddd</xsl:attribute>