Hi,
Just a quick question as to the difference between xpath's 'not' and '!=' in the following content.
Taking the XML:
<years>
<year value="2010"></year>
<year value="2010"></year>
<year value="2010"></year>
<year value="2009"></year>
</years>
I want to select unique years. I have struggled for a while to achieve this, but managed in the end, but in a curious way that I did not expect.
The following xpath is correct for my intention and returns two unique year nodes of 2009 and 2010.
years/year[not(@value = preceding-sibling::year/@value)]
The following only returns the 2009 year node.
years/year[@value != preceding-sibling::year/@value]
The only difference between them is the != and not operators. I've pondered on this a while and I can't find a difference that I could satisfactorily explain to anyone else.
Perhaps someone could help.
Cheers
Steve