我的XML文件是这样的:
<AllLogs>
<Clubs>
<Club id="a">
<Name>Aa</Name>
<City>Ab</City>
<County>Ac</County>
</Club>
<Club id="b">
<Name>Ba</Name>
<City>Bb</City>
<County>Bc</County>
</Club>
<Club id="c">
<Name>Ca</Name>
<City>Cb</City>
<County>Ac</County>
</Club>
</Clubs>
<Season Year="2015">
<Skiers clubId="a">
<Skier userName="andy">...</Skier>
</Skiers>
<Skiers clubId="a">
<Skier userName="brad">...</Skier>
</Skiers>
<Skiers clubId="b">
<Skier userName="gary">...</Skier>
</Skiers>
<Skiers clubId="c">
<Skier userName="fred">...</Skier>
</Skiers>
</Season>
<Skiers>
<Skier userName="andy">...</Skier>
</Skiers>
<Skiers>
<Skier userName="brad">...</Skier>
</Skiers>
<Skiers>
<Skier userName="gary">...</Skier>
</Skiers>
<Skiers>
<Skier userName="fred">...</Skier>
</Skiers>
</AllLogs>
我想要做的是在滑雪者列表中找到滑雪者(AllLogs /滑雪者/滑雪者元素的节点列表),他们在2015年为一个Ac-county俱乐部滑雪。
继承我的XPath:
$x('./AllLogs/Skiers/Skier[../../Season[@Year="2015"] and ../../County="Ac"]', root)
我得到的结果是XML中的所有Skier节点,而不是我想要的特定节点。我做错了什么?