我的XPath表達式中的錯誤在哪裏?我需要檢索所有上傳的視頻的平均等級大於或等於3的所有用戶的配置文件帶有謂詞和條件的XPath表達式
<?xml version="1.0" encoding="UTF-8"?>
<smileyvideo>
<video id="8628149">
<uploader>[email protected]</uploader>
<title>Bad Apple</title>
<ratings>
<rating user="[email protected]" value="1" />
<rating user="[email protected]" value="2" />
</ratings>
</video>
<video id="123456">
<uploader>[email protected]</uploader>
<title>Musician Cat</title>
<ratings>
<rating user="[email protected]" value="3" />
<rating user="[email protected]" value="3" />
<rating user="[email protected]" value="4" />
</ratings>
</video>
<video id="474920">
<uploader>[email protected]</uploader>
<title>Shrek</title>
<ratings>
<rating user="[email protected]" value="1" />
<rating user="[email protected]" value="1" />
</ratings>
</video>
<!-- Users List -->
<user>
<name>Emil P. Wager</name>
<email>[email protected]</email>
</user>
<user>
<name>Satsuya Oda</name>
<email>[email protected]</email>
</user>
<user>
<name>Anthony J. Jenkins</name>
<email>[email protected]</email>
<bio>I am a food scientist, currently working in iceland. Make sure to
check out my blog!</bio>
</user>
</smileyvideo>
我的XPath表達式是
//user[preceding-sibling::video/uploader[avg((following-sibling::ratings/rating/@value))>=3]/text()=//user/email/text()]
是什麼版本?我懷疑這可以使用XPath 1.0 .. – har07
是的,XPath 1.0不支持甚至函數,我認爲,我使用XPath 2.0 – JeyKo