I Created the following xml file
<?xml version="1.0" standalone="no"?>
<!DOCTYPE Movies SYSTEM "actressinfo.dtd">
<ActressInfo>
<Actress firstname="Robin" lastname="Nico" count="7"/>
<Actress firstname="some" lastname="chick" count="7"/>
<Actress firstname="random" lastname="chick" count="6"/>
</ActressInfo>
And I want to retrieve all values that are equal to max count in xquery
for $p in doc("actressinfo.xml") //ActressInfo
where $p/Actress/@count = max($p/Actress/@count)
return $p/Actress/@count
However this returns everything, why is it doing so? Despite the value returned by max being correct.