XSL for Converting Flat XML to Hierarchial XML

Just for the reference of XML, XSL enthusiasts, I will quickly demonstrate how you can convert a flat XML file to a hierarchial XML with nested nodes. When hierarchy is the focus, there can be many different XML structures, but for the sake of simplicity, I have chosen the below example. This example assumes that you have ID, PARENTID and LEVEL attributes in each node, and PARENTID being 0, blank or null means that the employee node is a root node. To achieve this conversion, we have to know the root nodes.

Read the rest of this entry »

Advertisements