【发布时间】:2017-09-30 13:29:51
【问题描述】:
鉴于以下表达式,如何使用= 更简洁明确?
(//h2/@id[contains(.,"foo") or contains(.,"bar") or contains(.,"baz"))[last()]
这是我尝试过的,但我的翻译说它无效:
(//h2/@id[text() = ("foo", "bar", "baz")])[last()]
我不能使用contains(),因为我需要防止子字符串匹配。我正在使用 XPath 1.0,an answer to a related question 是这个问题的推动力。
【问题讨论】:
标签: html xpath attributes equality