繁体   English   中英

在xpath中设置联合运算符

[英]Set Union Operator in xpath

<xsl:variable name="targetReceiverService">
        <EMP_EMPLOC_MAL curr="4.0">MAL</EMP_EMPLOC_MAL>
        <EMP_EMPLOC_SIN curr="1.6">SIN</EMP_EMPLOC_SIN>
        <EMP_EMPLOC_CHN curr="7.8">CHN</EMP_EMPLOC_CHN>
        <DEFAULT curr="1.0">NONE</DEFAULT>
    </xsl:variable>

    <xsl:variable name="targetCountryCode" select="$targetReceiverService/*[name() = $ReceiverService] | $targetReceiverService/DEFAULT"/>
<xsl:value-of select="$targetCountryCode "/>

为什么$ targetCountryCode的值显示仅是MAL,但由于“ |”不包含NONE 意思

xsl:value-of仅显示集合中第一个节点的值。 (至少使用XSL 1)

您可能可以显示所有这些

<xsl:for-each select="$targetCountryCode">
  <xsl:value-of select="."/>
</xsl:for-each>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM