I have a xml file which has a tag as below:
<locator xlink:type="locator" xlink:href="https://www.google.co.in/" xlink:title="Google" xlink:show="replace" xlink:actuate="onRequest" xlink:role="website" rank="1"> </locator>
There are many locator tag in the xml file with different roles and rank .
I am able to get the role of the above tag using @*[local-name()='role'
.
Now I need to get the rank attribute based on the role. Is there any way to fetch two attributes and there values together?
I am new to Xpath . Please help me with this.
Well
//locator[@xlink:role = 'website']/@rank
(with a suitable binding of the prefixxlink
to the namespacehttp://www.w3.org/1999/xlink
) is an example of selecting therank
attributes oflocator
elements where therole
iswebsite
.