I'm trying to group elements with similar headings together, the problem is that I don't know how they are going to appear in the xml, I just know the parent of the elements to be mapped, and the element name.
Code:
xml:
<element1>
<entry>
<section>
<title>title</title>
</section>
<section>
<title>title</title>
</section>
</entry>
<entry>
<section>
<title>title2</title>
</section>
</entry>
<entry>
<section>
<title>title3</title>
</section>
</entry>
<entry>
<section>
<title>title4</title>
<section>
<section>
<title>title5</title>
</section>
</section>
<section>
<section>
<title>title5</title>
</section>
</section>
</section>
</entry>
</element1>
I managed to group together the elements of the first level, but beyond that I can't get an xpath that will always work.