Reputation: 45
I want to know how to get an element that has a specific attribute without knowing the tag name of the element. I know that in XPath
you can write something like this:
//elementTag[@att="attValue"]
which searches for an element with the specified attribute. But is it possible to search for an element by only specifying the attribute tag name and the attribute value using XPath
?
I am using PHP.
Upvotes: 0
Views: 79
Reputation: 33658
All you have to do is to use a wildcard:
//*[@att="attValue"]
See section Node Tests in the XSLT 1.0 spec.
Upvotes: 2