Given the following expression, how can I use =
to be more concise and explicit?
(//h2/@id[contains(.,"foo") or contains(.,"bar") or contains(.,"baz"))[last()]
Here's what I tried, but my interpreter says it's not valid:
(//h2/@id[text() = ("foo", "bar", "baz")])[last()]
I cannot use contains()
because I need to guard against substring matches. I'm using XPath 1.0 and an answer to a related question is the impetus for this question.