Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何忽略xpath中的第一个和最后一个元素?在互联网上找不到任何示例。我只发现你可以[position()>1]用来忽略第一个元素,但我怎么能忽略最后一个?
[position()>1]
尝试[position()>1 and position()<last()]
[position()>1 and position()<last()]
您可以使用
[postion() < last()]
(如果表达式出现在 XML 文档中,例如 XSLT 样式表,那么您需要对<as进行转义<)
<
<