Given the desire to use XPath to select an XML Text Node based on its value, is there a better way than:
//*[text()="foo"]/text()
I'm assuming that there's something like:
//text()[self="foo"]
...but I don't know what to put for self.
In XPath the period or dot character . is the self, also known as the "context node".
This query…
//text()[.="foo"]
…will select all text nodes with the value of "foo".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With