On Thu, 2021-09-02 at 17:22 +0200, Rob Stapper wrote:
Hi Cristian,
Consider snippets [1] and [2], both result in false(). That can’t be right to me.
[1] () = 4 [2] () != 4
[1] means, there is an item in the left sequence whose atomized value is equal to some value on the right. There isn't, so it's false.
[2] means, there's some item on the left whose value is unequal to some value on the right. hence, (1, 2, 3) != (1, 2, 3) is true because for example 1 onthe left is != to 2 on the right. Since there is no such pair of items here the result is false.
!= is almost never useful - it doesn't do what most people expect, and was included in XPath 1 for completeness.
Use not($seq1 = $seq2) for more sanity, or use eq and ne for singletons.
Liam