1

ネストされた if ステートメントでいくつかの値をテストしようとしていますが、うまくいかないようです。最初の when ブロックは正常に動作しますが、それ以外の場合にヒットし、 when test=$country に入ると壊れます。「いつ、国が…の外にある」というテキストは正常に機能します。問題は、最後の 2 つの段落が印刷されないことです。私は XSLT を初めて使用するため、when ステートメントをネストする方法と関係があるかどうかはわかりません。

国は、ウェブサイトのロケールを US OR GB に変更したときです。

<xsl:choose>
<xsl:when test="target = 'FX'"> <!-- Normal page -->
    <xsl:choose>
        <xsl:when test="$country = 'US'">
            <p>Inside FX US. Country is <xsl:value-of select="$country" /></p>
        </xsl:when>
        <xsl:otherwise>
            <p>Inside FX GB. Country is <xsl:value-of select="$country" /></p>
        </xsl:otherwise>
    </xsl:choose>
</xsl:when>
<xsl:otherwise> <!-- Graph page -->

<p>Outside when and country is <xsl:value-of select="$country" /></p>
    <xsl:when test="$country = 'US'">
        <p>Inside LPBM US. Country is <xsl:value-of select="$country" /></p>
    </xsl:when>
    <xsl:otherwise>
        <p>Inside LPBM GB. Country is <xsl:value-of select="$country" /></p>
    </xsl:otherwise>
    </xsl:otherwise>
</xsl:choose>
4

1 に答える 1