Ive got a long list of xml elements.
Each element got an ID and a PARENT_ID.
How can I make a sitemap/nested list based on this? The elements with null value is the top parent elements.
I want to show the list with UL and LI`s in HTML.
<ROOT>
<SITEMAP>
<ARRAY>
<ID>1</ID>
<NAME>Test</NAME>
<PARENT_ID>NULL</PARENT_ID>
</ARRAY>
<ARRAY>
<ID>2</ID>
<NAME>Test2</NAME>
<PARENT_ID>3</PARENT_ID>
</ARRAY>
<ARRAY>
<ID>3</ID>
<NAME>Test3</NAME>
<PARENT_ID>NULL</PARENT_ID>
</ARRAY>
<ARRAY>
<ID>4</ID>
<NAME>Test4</NAME>
<PARENT_ID>1</PARENT_ID>
</ARRAY>
<ARRAY>
<ID>5</ID>
<NAME>Test5</NAME>
<PARENT_ID>4</PARENT_ID>
</ARRAY>
</SITEMAP>
The key template will look something like this:
And you kick it off with:
Be aware though that if there are any cycles in your hierarchy, this transformation will run infinitely.