<xsl:template match="/">
<xsl:variable name="a" select="'a'"/>
<xsl:variable name="b" select="'b'"/>
<xsl:variable name="c" select="'c'"/>
<xsl:variable name="result">
<xsl:choose>
<xsl:when test="$a !=''">
<xsl:value-of select="$a"/>
</xsl:when>
<xsl:when test="$b !=''">
<xsl:value-of select="$b"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$c"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
结果填充变量,在这里我使用了xsl选择语句。我只是想知道是否有其他有效或简单的方法来填充结果变量,基于与xsl选择相同的逻辑。填充用XSL变量选择
像这样的事情
<xsl:variable name="result" select="$a | $b | $c" />
以上会为节点集工作,而不是变量。任何输入?xsl 1.0
谢谢迪米特雷。 Super for xslt 1.0。 – Suresh 2012-02-18 16:52:24
@Maneesh:不客气。 – 2012-02-18 18:09:15