Just to provide some history/context for this thread, this is the 4th time this question has been posted over the last couple days, all presumably by
smunro16. Refer to
XML::Twig Output Help for actual code posted by the OP. Monks have been busy considering, and
janitors have been busy reaping/merging.
Note of caution: the XML in this OP has a few syntax errors, according to XML::Twig ("+" at the beginnings of lines, and the DOCTYPE line was also problematic).