<xsl:choose>

<xsl:choose> 元素用于定义一组选择中的一个。它的行为类似于过程式语言中的 switch 语句。

语法

xml
<xsl:choose>
  <xsl:when test="[whatever to test1]"></xsl:when>
  <xsl:when test="[whatever to test2]"></xsl:when>
  <xsl:otherwise></xsl:otherwise> [optional]
</xsl:choose>

必需属性

无。

可选属性

无。

类型

指令,与模板一起出现。它包含一个或多个 <xsl:when> 元素,以及一个可选的最终 <xsl:otherwise> 元素。

规范

XSLT,第 9.2 节。

Gecko 支持情况

支持。