2012-07-27 74 views
0
<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,因爲「|」意思是在xpath中設置聯盟運營商

回答

0

xsl:value-of只顯示集合中第一個節點的值。 (至少XSL 1)

,也許可以與

<xsl:for-each select="$targetCountryCode"> 
    <xsl:value-of select="."/> 
</xsl:for-each> 
顯示所有的人