26

我有一个带有相同标签的循环来加载十个单元格中的内容,但有不同的 div 标题和背景图像,所以我想知道是否有任何方法可以使用 switch case 来放置正确的 div 标题,当我为每个加载时XSL 中每个单元格的内容?像这样:<...在这里加载相同的标签内容...>请帮助我,因为我是 XSL 的新手,无论如何谢谢你!

4

1 回答 1

49

您可以使用 if 条件

<xsl:if test="expression">
  ...some output if the expression is true...
</xsl:if>

或选择,如果有多个条件要检查

<xsl:choose>
  <xsl:when test="expression">
    ... some output ...
  </xsl:when>
  <xsl:when test="another expression">
    ... some output ...
  </xsl:when>
  <xsl:otherwise>
    ... some output ....
  </xsl:otherwise>
</xsl:choose>
于 2009-08-03T10:08:52.667 回答