xslt中for-each交替设置背景颜色,常用技巧
- <table width="100%" border="1">
- <tr bgcolor="#C9BBAD">
- <th>name </th>
- <th>link </th>
- </tr>
- <xsl:for-each select="items/roomitem">
- <xsl:choose>
- <xsl:when test="(position() mod 2) = 0">
- <tr bgcolor="#C9BBAD">
- <td>
- <xsl:value-of select="text" />
- </td>
- <td>
- <xsl:value-of select="link" />
- </td>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- <tr>
- <td>
- <xsl:value-of select="text" />
- </td>
- <td>
- <xsl:value-of select="link" />
- </td>
- </tr>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </table>