I was able to use Postgresql(9.4.x) xpath searching to match against an xml attribute or element. Is it possible to search the combination of both attribute and element value?
<name>
<firstname>test</firstname>
<lastname>user</lastname>
<role num="10">admin</role>
<role num="8">readonly</role>
</name>
I was trying to match admin role with number 10 in the above sample xml and below query does return TRUE for 8-admin combination as well.
select xpath('//role/@num="8" and //role/text()="admin"', '<above xml>');
Please suggest if there is any better way to matching exact index combination.
Thanks.