简体   繁体   中英

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 "/>

why value display for $targetCountryCode is only MAL but not included NONE since the "|" mean

xsl:value-of only displays the value of the first node in the set. (at least with XSL 1)

You can probably display all of them with

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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