Subject: | XPath 'sum' fails due to missing to_number method |
Distribution: XML::XPath-1.12
Perl: 5.6.0
OS: Linux hawking 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
See attached test case. The expected results are:
count of BBB is 3
sum of BBB is 22
Under XML::XPath 1.12 (and previous versions, I assume), the actual results are:
count of BBB is 3
No such method to_number in XML::XPath::Node::ElementImpl at blib/lib/XML/XPath/Function.pm line 360
I added a simple to_number method to my local Element.pm. Patch below:
--- XPath/Node/Element.pm.orig Wed Mar 7 12:46:40 2001
+++ XPath/Node/Element.pm Wed Jan 30 15:28:20 2002
@@ -419,6 +419,10 @@
return $string;
}
+sub to_number {
+ return XML::XPath::Number->new(shift->string_value);
+}
+
1;
__END__
Message body not shown because it is not plain text.