Re: reversing or swapping nested node hierarchy
G. Ken Holman wrote: >I hope the code below helps. You don't say what you want done with >attributes, so I didn't do anything with them myself. > >. . . . . . . . . Ken > > Thanks for your reply. My example may have been too simple for what I'm trying to do. I should have specified that <a>, <b>, etc need to be transformed, so a simple node copy would not be enough. What I'm essentially looking for is a way to change the node hierarchy during transformation. So, if my document were: <root> <a name="alpha"> <b tag="beta" /> </a> </root> and my templates were: <template match="a"> <aa> <copy-of select="@name" /> </aa> </template> <template match="b"> <bb> <copy-of select="@tag" /> </bb> </template> would there be a way to produce this output: <doc> <bb tag="beta"> <aa name="alpha"> </bb> </doc> where the node hierarchy a/b has been reversed to become bb/aa ? The optimal solution would leave the "b" template generic so the element could be included under other elements like <a>, <c> and <d> in your example. Thanks, Chris.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format