Im working with PHP5, and I need to transform XML in the following form:
<section>
<heading>
<line absolutePage="4" page="2" num="35">A Heading</line>
</heading>
<subsection type="type1">
<heading label="3">
<line absolutePage="4" page="2" num="36">A Subheading</line>
</heading>
<content/>
</subsection>
</section>
Into something like this:
<section name="A Heading">
<heading>
<line absolutePage="4" page="2" num="35">A Heading</line>
</heading>
<subsection type="type1" label="3" name="A Subheading">
<heading label="3">
<line absolutePage="4" page="2" num="36">A Subheading</line>
</heading>
<content/>
</subsection>
</section>
Note that the label
attribute has been been copied from the heading attribute to the parent element.
Also the text of the heading/line
element has been added as an attribute of the heading
parent node.
Thanks,