1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
Bug: #374672
--- a/XPath/Expr.pm
+++ b/XPath/Expr.pm
@@ -330,7 +330,7 @@ sub op_nequals {
sub op_le {
my ($node, $lhs, $rhs) = @_;
- op_gt($node, $rhs, $lhs);
+ op_ge($node, $rhs, $lhs);
}
sub op_ge {
@@ -359,31 +359,21 @@ sub op_ge {
!$rh_results->isa('XML::XPath::NodeSet'))) {
# (that says: one is a nodeset, and one is not a nodeset)
- my ($nodeset, $other);
- my ($true, $false);
if ($lh_results->isa('XML::XPath::NodeSet')) {
- $nodeset = $lh_results;
- $other = $rh_results;
- # we do this because unlike ==, these ops are direction dependant
- ($false, $true) = (XML::XPath::Boolean->False, XML::XPath::Boolean->True);
+ foreach my $node ($lh_results->get_nodelist) {
+ if ($node->to_number->value >= $rh_results->to_number->value) {
+ return XML::XPath::Boolean->True;
+ }
+ }
}
else {
- $nodeset = $rh_results;
- $other = $lh_results;
- # ditto above comment
- ($true, $false) = (XML::XPath::Boolean->False, XML::XPath::Boolean->True);
- }
-
- # True if and only if there is a node in the
- # nodeset such that the result of performing
- # the comparison on <type>(string_value($node))
- # is true.
- foreach my $node ($nodeset->get_nodelist) {
- if ($node->to_number->value >= $other->to_number->value) {
- return $true;
+ foreach my $node ($rh_results->get_nodelist) {
+ if ( $lh_results->to_number->value >= $node->to_number->value) {
+ return XML::XPath::Boolean->True;
+ }
}
}
- return $false;
+ return XML::XPath::Boolean->False;
}
else { # Neither is a nodeset
if ($lh_results->isa('XML::XPath::Boolean') ||
@@ -429,31 +419,21 @@ sub op_gt {
!$rh_results->isa('XML::XPath::NodeSet'))) {
# (that says: one is a nodeset, and one is not a nodeset)
- my ($nodeset, $other);
- my ($true, $false);
if ($lh_results->isa('XML::XPath::NodeSet')) {
- $nodeset = $lh_results;
- $other = $rh_results;
- # we do this because unlike ==, these ops are direction dependant
- ($false, $true) = (XML::XPath::Boolean->False, XML::XPath::Boolean->True);
+ foreach my $node ($lh_results->get_nodelist) {
+ if ($node->to_number->value > $rh_results->to_number->value) {
+ return XML::XPath::Boolean->True;
+ }
+ }
}
else {
- $nodeset = $rh_results;
- $other = $lh_results;
- # ditto above comment
- ($true, $false) = (XML::XPath::Boolean->False, XML::XPath::Boolean->True);
- }
-
- # True if and only if there is a node in the
- # nodeset such that the result of performing
- # the comparison on <type>(string_value($node))
- # is true.
- foreach my $node ($nodeset->get_nodelist) {
- if ($node->to_number->value > $other->to_number->value) {
- return $true;
+ foreach my $node ($rh_results->get_nodelist) {
+ if ( $lh_results->to_number->value > $node->to_number->value) {
+ return XML::XPath::Boolean->True;
+ }
}
}
- return $false;
+ return XML::XPath::Boolean->False;
}
else { # Neither is a nodeset
if ($lh_results->isa('XML::XPath::Boolean') ||
|