gpt4 book ai didi

xslt - xpath 表达式依赖于 sibling

转载 作者:行者123 更新时间:2023-12-03 16:54:30 28 4
gpt4 key购买 nike

<a id ="1">
...<c>
......<b/>
......<f/>
......<b/>
......<f/>
...</c>
</a>
<a id="2">
...<c>
......<b/>
......<f/>
......<f/>
...</c>
</a>

如果任何元素 b 后接两个或多个 f 元素,则返回节点 a。如果可能的话,我更喜欢直接的 XPath 2.0 解决方案。什么 xpath 会给我 a2 而不是 a1?我曾尝试关注 sibling 、职位等,但无济于事。

最佳答案

使用 XPath 1.0:

a[.//b[following-sibling::*[1]/self::f and following-sibling::*[2]/self::f]]

关于xslt - xpath 表达式依赖于 sibling ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19232606/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com