<xsl:variable name="color"> <xsl:choose> <xsl:when test="@color"> <xsl:value-of select="@color"/> </xsl:when> <xsl:otherwise>green</xsl:otherwise> </xsl:choose> </xsl:variable> XSLT 元素参考手册
</xsl:choose> 在何处放置选择条件 如需插入针对 XML 文件的多重条件测试,请向 XSL 文件添加 <xsl:choose>、<xsl:when> 以及 <xsl:otherwise> 元素: 实例 <?xmlversion="1.0"encoding="UTF-8"?><xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:templatematch="/...
XSLT(Extensible Stylesheet Language Transformations)是一种用于将XML文档转换为其他格式的语言。它是一种基于XML的转换语言,用于将XML文档从一种结构转换为另一种结构,或者将XML文档转换为其他格式,如HTML、PDF等。 <xsl:choose>元素是XSLT中的一个条件选择元素,用于根据不同的条件选择不同的处理方式。它可以包含多个...
XSLT <xsl:choose> 元素 XSLT 元素参考手册 定义和用法 <xsl:choose> 元素与 <xsl:when> 以及 <xsl:otherwise> 协同使用,来表达多重条件测试。 如果没有 <xsl:when> 是 true,则处理 <xsl:otherwise> 的内容。 如果没有 <xsl:when> 是 true,且不存在 <xsl:otherwise> 元素,则不创建任何内容。 提示:...
<xsl:choose> 元素与 <xsl:when> 以及 <xsl:otherwise> 协同使用,来表达多重条件测试。 如果没有 <xsl:when> 是 true,则处理 <xsl:otherwise> 的内容。 如果没有 <xsl:when> 是 true,且不存在 <xsl:otherwise> 元素,则不创建任何内容。 提示:对于简单的条件测试,请使用 <xsl:if> 元素取而代之。
<xsl:choose> 元素与 <xsl:when> 以及 <xsl:otherwise> 元素结合,可表达多重条件测试。 如果没有 <xsl:when> 是 true,则处理 <xsl:otherwise> 的内容。 如果没有 <xsl:when> 是 true,且不存在 <xsl:otherwise> 元素,则不创建任何内容。 提示:对于简单的条件测试,请使用 <xsl:if> 元素取而代之。
XSLT <xsl:choose> 元素用于结合 <xsl:when> 和 <xsl:otherwise> 来表达多重条件测试。<xsl:choose> 元素 语法 <xsl:choose> <xsl:when test="expression"> ... 输出 ... </xsl:when> <xsl:otherwise> ... 输出 ... </xsl:otherwise> </xsl:choose>在何...
</xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> </xsl:stylesheet> 尝试一下 » 上面的代码会在 CD 的价格高于 10 时向 "Artist" 列添加粉色的背景颜色。 另一个实例 这是另外一个包含两个 <xsl:when> 元素的实例: 实例 <?xml version="1.0" encoding="ISO-8859-...
<xsl:choose> 元素用于结合 <xsl:when> 和 <xsl:otherwise> 来表达多重条件测试。<xsl:choose> 元素语法<xsl:choose> <xsl:when test="expression"> ... some output ... </xsl:when> <xsl:otherwise> ... some output ... </xsl:otherwise> </xsl:choose> 在...