http://www.perlmonks.org?node_id=1005131


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 +"]/text())] ;
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ