开发者

Selection attribute value with xpath by filtering on a subitem-value

how can I select a node-attribute with xpath by filtering on a subnode-attribute?

I have a xml structure like this:

<base>
  <item name="foo">
    <subitem value="blubb" />
  </item>
</base>

N开发者_StackOverflow中文版ow I want the name-attribute-value ("foo") from the item-tag(s) where the value-attribute of the subitem(s) is "blubb".

Thx 4 help


Use:

string(/*/item[subitem/@value='blubb']/@name)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜