my $t = XML::Twig->new( twig_roots => {'nitf/body/body.head/hedline/hl1' => \&fix_hl1, 'nitf/body/body.head/hedline/hl2' => \&fix_hl2, _default_ => \&fixup, }, twig_print_outside_roots => 1, keep_encoding => 1, );