20

Totally new to xpath.

I have xml:

<Values>
   <Value Value="a" CustomAtr="1" />
   <Value Value="b" CustomAtr="2" />
   <Value Value="c" CustomAtr="3" />
</Values>

To get value by index, i can use: string(/*/Value[1]/@CustomAtr)

Is it possible to get value by key? Hot to get CustomAtr value where Value="b" ?

Thank you

Deduplicator
  • 43,322
  • 6
  • 62
  • 109
Sergejs
  • 2,450
  • 6
  • 31
  • 50

1 Answers1

42

this should do the trick:

string(//Value[@Value='b']/@CustomAttr)