XML refactoring: wrap element
Posted: Thu May 18, 2017 4:35 am
Hi,
I try to wrap several elements with another one using the Wrap Element operation but I don't get the expected result.
My XML looks like this:
What I like to get is the following:
As Target Elements I entered the following XPath: y-a, y-b, y-c
As Local Name I entered: y
What I get is:
Could you please advise what XPath expression I should enter as Target Elements to get my expected result?
Follow-up question: What should the XPath expression look like, if I have the mentioned XML code in several files and in some of them there is no <y-b> , but <y-a> and <y-c> only?
Thanks a lot,
Jörg
I try to wrap several elements with another one using the Wrap Element operation but I don't get the expected result.
My XML looks like this:
Code: Select all
<x>
<y-a>some text</y-a>
<y-b>some text</y-b>
<y-c>some text</y-b>
</x>
Code: Select all
<x>
<y>
<y-a>some text</y-a>
<y-b>some text</y-b>
<y-c>some text</y-b>
</y>
</x>
As Local Name I entered: y
What I get is:
Code: Select all
<x>
<y>
<y-a>some text</y-a>
</y>
<y>
<y-b>some text</y-b>
</y>
<y>
<y-c>some text</y-c>
</y>
</x>
Follow-up question: What should the XPath expression look like, if I have the mentioned XML code in several files and in some of them there is no <y-b> , but <y-a> and <y-c> only?
Thanks a lot,
Jörg