I am trying to learn xslt and I'm having difficulties trying to figure out how to process a file that is not built out as a hierarchy (except based on an attribute) and change it into a hierarchy.
Using the following XML
<?xml version="1.0" encoding="UTF-8"?>
<data>
<h level="1">test</h>
<p>some data for test</p>
<h level="2">test2</h>
<p>some data for test2</p>
<h level="3">test3</h>
<p>some data for test3</p>
<h level="2">test4</h>
<p>some data for test4</p>
<h level="1">test5</h>
<p>some data for test5</p>
<h level="1">test6</h>
<p>some data for test6</p>
<h level="2">test7</h>
<p>some data for test7</p>
</data>
I'd like to convert it to look like:
<data>
<node name="test">
<text>some data for test</text>
<node name="test2">
<text>some data for test2</text>
<node name="test3">
<text>some data for test3</text>
</node>
</node>
<node name="test4>
<text>some data for test4</text>
</node>
</node>
<node name="test5">
<text>some data for test5</text>
</node>
<node name="test6">
<text>some data for test6</text>
<node name="test7">
<text>some data for test7</text>
</node>
</node>
</data>
Thanks for any pointers you can give me that would start me on my way.