1
給出以下表達式,如何使用=
可以更簡潔明確?XPath多個屬性值中的一個,條件爲
(//h2/@id[contains(.,"foo") or contains(.,"bar") or contains(.,"baz"))[last()]
這是我嘗試過,但我解釋說,這是無效的:
(//h2/@id[text() = ("foo", "bar", "baz")])[last()]
我不能使用,因爲我需要防範的子字符串匹配。我正在使用XPath 1.0和an answer to a related question是這個問題的動力。
和高個,用於提供的XPath 2.0當量。太感謝了!! –