【问题标题】:how to check with 2 conditions for test in xsl:when如何在 xsl:when 中检查 2 个测试条件
【发布时间】:2009-10-31 11:08:19
【问题描述】:

我想检查 test1 和 test 2 的值。如果 test1 计算结果为 Yes,则显示 Yes,如果 test2 计算结果为 Yes,则显示 Invalid,否则显示 test1 的确切值。

我尝试了以下

<xsl:choose>
    <xsl:when test="$test1 = 'Yes' or 'Yes'">
         <td>
                          Yes
         </td>
    </xsl:when>

    <xsl:when test="$test2 = 'Yes' or 'yes'">
         <td>
                          INVALID
         </td>
    </xsl:when>

    <xsl:otherwise> 
        <td>
            <font size="2">
                f<xsl:apply-templates select="../DBE:Object/DBE:Attribute[@name='test1']"/> 
            </font>
        </td>
    </xsl:otherwise>

</xsl:choose>

但它没有正确评估条件。请提出可能的解决方案。

【问题讨论】:

    标签: xslt


    【解决方案1】:

    我想你可能正在寻找这样的东西:

    <xsl:when test="$test1 = 'Yes' or $test1 = 'yes'">
    

    您必须为每次比较重复$test1 =,否则您的测试条件并不符合您的预期。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-28
      • 1970-01-01
      • 2011-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-24
      相关资源
      最近更新 更多