in reply to
Finding max value from a unique tag from XML
A single XPath expression can find a maximum. Here is an example using XML::XSH2, a wrapper around XML::LibXML:
open 1.xml ;
echo //doc/str[@name="docuid" and not(text() < //doc/str[@name="docuid
That's more XPath wizardry than I'd normally manage. FWIW, here's the translation of the above to plain old XML::LibXML:
use XML::LibXML 1.70;
my $xml = XML::LibXML->load_xml(location => "1.xml");
//doc/str[@name="docuid" and not(text() < //doc/str[@name="docuid"
A foolish day
Just another day
Internet cleaning day
The real first day of Spring
The real first day of Autumn
Wait a second, ... is this poll a joke?
Results (481 votes),