in reply to Re^2: How to retrieve the last node value
in thread Retrieving the last node value from an XML file

Greatest value of what? NICK?, ROWID?, RANK?

If you just want to get the last node in the list:

#!/usr/local/bin/perl use XML::XPath; my $file = 'test.xml'; my $xp = XML::XPath->new(filename=>$file); my $nodeset = $xp->find('/MEMBERLIST/LIST[position()=last()]'); foreach my $node ($nodeset->get_nodelist) { print "FOUND\n\n", XML::XPath::XMLParser::as_string($node), "\n\n"; }

If you want the greatest value of a particular field then you're going to have to sort by that field first. I think that's the point where you run into limitations with XML::XPath (and I would recommend a combination of XML::LibXML and XML::LibXSLT.

-derby

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.