my $twig=XML::Twig->new( twig_handlers =>{ #'//*[total="609" and passed="609"]' =>sub { # i wonder why this doesn't work..? '//*[@total="609"]' =>sub { my ($twig,$elt)=@_; last if ( $elt->att("passed") ne "609"); last if ( $elt->att("skipped") ne "0"); last if ( $elt->att("blocked") ne "0"); if ($elt->parent->gi eq 'workflow' ){ $elt->parent->print; } } }, PrettyPrint=>'indented', )->parsefile('xml_without_error.xml');