I want to move around elements in an xml document with xmlstarlet
Specifically I want to make the following changes
<parent> <before/> <span><a>blah</a></span> <after/> <parent> <otherparent> <span><a>blah</a></span> <otherparent> becomes ..
<parent> <before/> <a>blah</a> <after/> </parent> <otherparent> <a>blah</a> </otherparent> I.e delete span but keep the children.
xmlstarlet has a move command: xmlstart ed -m source target but I don't really understand how it works.
It takes a source and a target xpath but I don't really understand how these get matched up because they can result in sets of different sizes. Is the target relative to the source?
<a>blah</a>is located/inserted. Post the structure with parent nodes<div><span id="1"><span><a>blah</a></span></span></div><div></div><div><span id="2"><span><a>blah</a></span></span></div>