<foo>
<bar id="1" score="100" group="beginner" />
<bar id="2" score="200" group="beginner" />
<bar id="3" score="300" group="expert" />
...
</foo>
我尝试这样使用,但是出了点问题(xpath 1.0)
foo/bar[@group='beginner' and not(@score<= preceding-sibling::bar/@score) and not(@score<=following-sibling::bar/@score)]
答案 0 :(得分:1)
使用 xpath 1.0
/foo/bar[@group='beginner'][(not(preceding-sibling::bar[@group='beginner']/@score >= @score) and not(following-sibling::bar[@group='beginner']/@score > @score)) or (not(preceding-sibling::bar[@group='beginner']/@score <= @score) and not(following-sibling::bar[@group='beginner']/@score < @score))]/@score