Given this simple xml:
<root>
<child id="foo" />
<child id="bar" />
</root>
I want to select the attribute with value = foo.
This xpath works: root/child[@id='foo']/@id
but it seems there should be a way to accomplish the same without redundantly specifying the attribute name. Is it possible?
I've seen many discussions on finding an element using an attribute value; but in this case I want to return the attribute itself.
How about
A dot means the current node, it doesn't necessarily have to be an element.