This is a small sample of my xml file.
w:val
attribute is in namespace, so you can't just address it by @val
. One possible solution is by using @*[local-name()='attribute name']
expression to address an attribute by it's local name, similar to what you've done for elements :
//*[local-name()="highlight"][@*[local-name()='val' and .='yellow']]/../..//*[local-name()="t"]