Move XML element using XDT



Is there a way to move an XML element, including all of its content, inside another element using XDT?


For example, I'd like to transform the following XML:



<?xml version="1.0"?>
<a>
<b someAttribute="someValue">someContent</b>
</a>


into this:



<?xml version="1.0"?>
<a>
<c>
<b someAttribute="someValue">someContent</b>
</c>
</a>


by moving the b element inside of the newly created c element. I was hoping that something like the following would work:



<?xml version="1.0"?>
<a xmlns:xdt="http://ift.tt/1fUQU29">
<c xdt:Transform="Insert">
<b xdt:Locator="XPath(/a/b)" xdt:Transform="an appropriate transform" />
</c>
</a>


But AFAIK there is no transform that would do this.


No comments:

Post a Comment