aaaa sdfsfsdfsd aaaa sdfsfsdfsd aaaa sdfsfsdfsd

.net xdt transform only replaces first match

302 Views Asked by At

I have a config file I'm transforming:

<?xml version="1.0" encoding="utf-8"?>
<TopNode>
  <Sub>
    <subnode>aaaa</subnode>
    <othernode>sdfsfsdfsd</othernode>
  </Sub>
  <Sub>
    <subnode>aaaa</subnode>
    <othernode>iiiiiii</othernode>
  </Sub>
  <Sub>
    <subnode>aaaa</subnode>
    <othernode>blahblahblahblabhlahb</othernode>
  </Sub>
  <Sub>
    <subnode>aaaa</subnode>
    <othernode>sdfsdfseeferererer</othernode>
  </Sub>  
</TopNode>

I have this transform:

<?xml version="1.0" encoding="utf-8" ?>
<TopNode xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <Sub>
    <subnode xdt:Transform="Replace">replaceallwiththis</subnode>
  </Sub>
</TopNode>

It only replaces the first subnode match. How do I get it to replace all?

I also try like this but no work:

<subnode xdt:Locator="Condition(.)" xdt:Transform="Replace">replaceallwiththis</subnode>

I also trya dis but she a no work (only replaces first match):

<subnode xdt:Locator="XPath(//TopNode/Sub[subnode='aaaa']/subnode)" xdt:Transform="Replace">zzzzzzzzzzzzzzzzzzz</subnode>
0

There are 0 best solutions below