in reply to Replacing Data within XML Element

Use a twig_handler for datafield , use xpath to debug the order that your handlers are called, example in Re^2: XML:: Twig - can you check for text following the element being handled?, Re^3: parse xml and store data in array of hashesh, Re: How to return two and more values by parsing XML with XML::Rules?, Re^3: change setHandlers XML::Parser

Or only use datafield handler and use findnodes to filter subfield children