xsl获取未在键中进行比较的节点

问题描述 投票:0回答:2

在此示例中,我有此xml

<CityStates>
<States>
    <State Abbr="AL">Alabama</State>
    <State Abbr="AK">Alaska</State>
    <State Abbr="AZ">Arizona</State>
    <State Abbr="AR">Arkansas</State>
</States>
<Cities>
    <City State="NY" >New York</City>
    <City State="CA" >Los Angeles</City>
    <City State="AZ" >Chicago</City>
    <City State="AR" >Houston</City>
    <City State="AR" >Philadelphia</City>   
  </Cities>
</CityStates>

我只想用Key()查看没有State的节点xsl是这个:

<xsl:key name="keyState" match="State" use="@Abbr"/>
<xsl:template match="/">
            <xsl:for-each select="//City">
                    <xsl:value-of select="City"/>
            </xsl:for-each>
</xsl:template>
xslt xslt-1.0
2个回答
0
投票

使用谓词City[not(key('keyState', @State))],即


0
投票

尝试类似的东西:

© www.soinside.com 2019 - 2024. All rights reserved.