tags:

views:

54

answers:

1

Hi everyone, 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>

Now 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

A: 

Use:

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

Dimitre Novatchev