use 5.010; use XML::LibXML 1.70; my $xml = XML::LibXML->load_xml(location => "1.xml"); say $xml->findnodes(q{ //doc/str[@name="docuid" and not(text() < //doc/str[@name="docuid"]/text())] });