我对 XSL 语句有另一个问题。我正在尝试添加一个条件,以便如果找到某个值,在这种情况下“调用”,那么它的行为会略有不同。我知道这是一件简单的事情我做错了,但不知道是什么!
基本上在下面的代码中似乎返回了正确的布尔值,但是它继续进行并且仍然保留了调用成本的措辞。类和 URL 位置都正确输出。
提前致谢!
XML
<rhs_options>
<title>RHS title</title>
<service>
    <option>call</option>
    <text>telephone number text</text>
    <telephone>telephone number</telephone>
    <link>telephone number link</link>
</service>
<service>
    <option>branch</option>
    <text>branch text</text>
    <telephone/>
    <link>branch link</link>
</service>
<service>
    <option>online</option>
    <text>online text</text>
    <telephone/>
    <link>online link</link>
</service>
XSL
<aside class="cta">
<h4><xsl:value-of select="/Properties/Data/Datum[@ID='ID1']/DCR[@Type='RHS_Options']/rhs_options/title"/></h4>
    <xsl:for-each select="/Properties/Data/Datum[@ID='ID1']/DCR[@Type='RHS_Options']/rhs_options/service">  
        <xsl:choose>
            <xsl:when test="/Properties/Data/Datum[@ID='ID1']/DCR[@Type='RHS_Options']/rhs_options/service/option='call'">
                <p class="{./option}">
                    <xsl:value-of select="./text"/>
                        <br/>
                    <xsl:value-of select="./telephone"/>
                        <br/>
                    <a href="{./link}">
                        Call charges
                    </a>
                </p>
            </xsl:when>
            <xsl:when test="/Properties/Data/Datum[@ID='ID1']/DCR[@Type='RHS_Options']/rhs_options/service/option='phone'or'online'">
                <p class="{./option}">
                    <a href="{./link}">
                        <xsl:value-of select="./text"/>
                    </a>
                </p>
            </xsl:when>
        </xsl:choose>   
    </xsl:for-each>