Going another step further into comparison expressions... currently, in the
expression:
    $foo < $bar

where $foo and $bar are non-set Objects, we basically use compareTo() on the
two objects. According to the XPath spec, this doesn't seem exactly correct.
See below:

----------------------snip----------------------------
3.4 Booleans

[omitted]

When neither object to be compared is a node-set and the operator is = or
!=, then the objects are compared by converting them to a common type as
follows and then comparing them. If at least one object to be compared is a
boolean, then each object to be compared is converted to a boolean as if by
applying the boolean function. Otherwise, if at least one object to be
compared is a number, then each object to be compared is converted to a
number as if by applying the number function. Otherwise, both objects to be
compared are converted to strings as if by applying the string function. The
= comparison will be true if and only if the objects are equal; the !=
comparison will be true if and only if the objects are not equal. Numbers
are compared for equality according to IEEE 754 [IEEE 754]. Two booleans are
equal if either both are true or both are false. Two strings are equal if
and only if they consist of the same sequence of UCS characters.

    NOTE: If $x is bound to a node-set, then $x="foo" does not mean the same
as not($x!="foo"): the former is true if and only if some node in $x has the
string-value foo; the latter is true if and only if all nodes in $x have the
string-value foo.

When neither object to be compared is a node-set and the operator is <=, <,
>= or >, then the objects are compared by converting both objects to numbers
and comparing the numbers according to IEEE 754. The < comparison will be
true if and only if the first number is less than the second number. The <=
comparison will be true if and only if the first number is less than or
equal to the second number. The > comparison will be true if and only if the
first number is greater than the second number. The >= comparison will be
true if and only if the first number is greater than or equal to the second
number.

----------------------snip----------------------------

If we're doing greater than, less than, greater equal or less equal, we
should convert to numbers first if possible. If we're doing equal or not
equal, we check if any of them are booleans, if not then if either of them
are numbers, and finally if all else fails compare by string values.

Since this isn't the current implementation unless anyone has any objections
I'll go ahead and make the change.

-Mark


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to