Skip Menu |

This queue is for tickets about the XML-XPath CPAN distribution.

Report information
The Basics
Id: 235
Status: resolved
Priority: 0/
Queue: XML-XPath

People
Owner: Nobody in particular
Requestors: chadh [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.12
Fixed in: (no value)



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__
Download test-sum
application/octet-stream 406b

Message body not shown because it is not plain text.

From: Roland Moriz
this also affects: my $xp = XML::XPath->new(filename => 'config/r2x.xml'); my $nodeset = $xp->find('/config/export/users/user[@status > 0 ]/@id'); ... No such method to_number in XML::XPath::Node::AttributeImpl at /usr/local/lib/perl5/site_perl/5.6.1/XML/XPath/Expr.pm line 452 I temporarily fixed that by adding the mention fix also to Node/Attribute.pm. I also wrote an email to Matt (Author of it) to fix this. thanks, regards, Roland
Fixed in CVS. to_number put in Node.pm (so it'll work for all) and sum() function fixed so it doesn't try and cross sum multiple nodes.