What are you trying to do? The template isn't doing the parsing. It is using XML::Simple or XML::DOM to do the parsing. And then doing something with the result.
I think it makes much more sense to do the parsing outside the template. Then feed to the parsed data, or even the DOM tree, to the template to output.