xsl-list
[Top] [All Lists]

Re: Global extension function

2003-02-24 09:42:36
Hi TP,

What I want to do is change the background color of the table every
3 lines. This is the only way that I have found to do this. If you
or someone have some ideas on how to solve this using standard xsl,
I would appreciate it.

Use position() mod 3 = 1 to identify every third line, so something
along the lines of:

  <xsl:for-each select="line">
    <xsl:variable name="background">
      <xsl:choose>
        <xsl:when test="position() mod 3 = 1">white</xsl:when>
        <xsl:otherwise>#d4e3ff</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <div style="background-color: {$background};
                color: black; margin-top: 0px; margin-left: 2px;
                margin-right: 2px; margine-bottom: -19px">
      ...
    </div>
  </xsl:for-each>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list