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


in reply to Re^4: How to return two and more values by parsing XML with XML::Rules?
in thread How to return two and more values by parsing XML with XML::Rules?

My main problem however ist that I need to represent the LK-Keys at the same hierarchy level as the AM-Keys.

Your updated output doesn't show that. Only AM04 is found in your sample data.

Anyway, see Re: How to return two and more values by parsing XML with XML::Rules?, save the key callback

my $amlk = sub { print $_->xpath, "\n"; push @amk, $_->trimmed_text; };

Then register some twig_handlers

'AM_Key' => $amlk, 'LK_Key' => $amlk,