XML document:
Hello!
Recommendation: Never use the != operator to compare inequality where one or both arguments are node-sets.
By definition the expression:
$node-set != $value
evaluates to true() exactly when there is at least one node in $node-set such that its string value is not equal to the string value of $value.
Using this definition:
$empty-nodeset != $value
is always false(), because there isn't even a single node in $empty-nodeset for which the inequality holds.
Solution:
Use:
not($node-set = $value)
Then you get all results true(), as wanted.