I have a input XML file (not HTML) and I want to make changes to the tags. Wherever I find "p" node is child of "step" node, I need to remove it but the content should remain and assigned to "step". Also, the output should be a xml file and I am using R.
<h2>
<h4>
<stepgrp type="ordered-legal">
<figgrp-inlist>
<step>
<graphic version="1" object-id="4188" />
<p>Install the clutch spring compressor.</p>
</step>
<stepgrp2 type="unordered-bullet">
<step>
<p>One piece case use J414202
Disc.</p>
</step>
<step>
Two piece case use J42628 Disc.
</step>
</stepgrp2>
</figgrp-inlist>
<figgrp-inlist>
<step>
<graphic version="1" object-id="59269" />
<p>Tighten the clutch spring compressor.</p>
</step>
<step>
Remove the low/reverse clutch retainer ring.
</step>
<step>
Remove the low/reverse the clutch spring assembly.
</step>
</figgrp-inlist>
<figgrp-inlist>
<step>
<graphic version="1" object-id="4190" />
<p>Blow compressed air into the case passage to remove the
low/reverse clutch piston.</p>
</step>
</figgrp-inlist>
</stepgrp>
</h4>
</h2>
I have written a for loop code where it identifies the line position of "p" and "step" nodes but I want to make it dynamic so that it identifies the "p" node and removes it whenever it is the child of "step" node but the content should remain.
Thank you!