Further suppose that the schema allows section tags to contain any single letter tag a-z. Also any single letter tag a-z may contain any combination of single letter tags a-z. All single letter tags support mixed content as well.
How is it possible using XSLT to do convert the document to one such as the following.
The idea is that whenever a new type attribute is encountered on a tag, we close the close everything up to a certain stopping point such as the child of root in this case, and then we re-open duplicates of everything, and continue on with the processing.
I think it is fairly trivial to write a transform that goes from the latter to the former, but I can think of no way to go from the former to the latter.