热门:网页模板.net视频教程JQueryMVCjsonExtJs源码示例三级联动JQuery菜单
您现在的位置:.Net中文社区>> XML编程>>正文内容

xslt中for-each交替设置背景颜色

发布时间:2010年07月03日点击数: 佚名

xslt中for-each交替设置背景颜色,常用技巧

  1. <table width="100%" border="1">   
  2.        <tr bgcolor="#C9BBAD">   
  3.          <th>name </th>   
  4.          <th>link </th>   
  5.        </tr>   
  6.        <xsl:for-each select="items/roomitem">   
  7.          <xsl:choose>   
  8.            <xsl:when test="(position() mod 2) = 0">   
  9.            <tr bgcolor="#C9BBAD">   
  10.            <td>   
  11.              <xsl:value-of select="text" />   
  12.            </td>   
  13.            <td>   
  14.              <xsl:value-of select="link" />   
  15.            </td>   
  16.            </tr>   
  17.            </xsl:when>   
  18.            <xsl:otherwise>   
  19.              <tr>   
  20.                <td>   
  21.                  <xsl:value-of select="text" />   
  22.                </td>   
  23.                <td>   
  24.                  <xsl:value-of select="link" />   
  25.                </td>   
  26.              </tr>   
  27.            </xsl:otherwise>   
  28.          </xsl:choose>   
  29.        </xsl:for-each>   
  30.      </table> 

本站热点业务

更多模板/案例展示

热门推荐

关于我们 | 联系我们 | 团队日志 | 网站地图 | 网站合作