Skip to content
Sergey Zwezdin edited this page Jun 18, 2016 · 2 revisions

Magic Chunks allow you to transform XML files.

<configuration>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5.1" />
    <authentication mode="None" />
  </system.web>
</configuration>

You can address items in XML in different ways:

  • Point node by path − configuraion/system.web
  • Point node by path with attribute value − configuration/appSettings/add[@key='PreserveLoginUrl']
  • Point attribute value by path with attribute value − configuration/appSettings/add[@key='PreserveLoginUrl']/@value

Root node name

Please note that you can have single root node for XML. So if the first element in transformation path does not match name of root element in source file you will get error:

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5.1" />
    <authentication mode="None" />
  </system.web>
</configuration>

settings/key1ERROR will happen for this transformation