xdt transform adding redundant namespace

267 views Asked by At

When using xdt transformation on a xml file which is using xml schema namespace, is there any approach which doesn't add a redundant namespace of a replaced element?

Input:

<myrootnode xmlns="http://myschema">
  <thenode>myOLDvalue</thenode>
</myrootnode>

Transform:

<s:myrootnode xmlns:s="http://myschema" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <s:thenode xdt:Transform="Replace">myNEWvalue</s:thenode>
</s:myrootnode>

Output:

<myrootnode xmlns="http://myschema">
  <s:thenode xmlns:s="http://myschema">myNEWvalue</s:thenode>
</myrootnode>

I've also tried using XPath locator, with the same result. Transform:

<myrootnode xmlns:s="http://myschema" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <s:thenode xdt:Transform="Replace" xdt:Locator="XPath(//s:thenode)">myNEWvalue</s:thenode>
</myrootnode>

I would like this output:

<myrootnode xmlns="http://myschema">
  <thenode>myNEWvalue</thenode>
</myrootnode>

Is it possible using xdt?

0

There are 0 answers