title: How to apply two different transformations on one web.config element?
body: <p>
  From my VS2010 deployment project I would like to apply two different transformations to two different attributes of one element in my web.config. Consider the following web.config snippet:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;exampleElement attr1="false" attr2="false" attr3="true" attr4="~/" attr5="false"&gt;
    &lt;supportedLanguages&gt;
      &lt;!-- Some more elements here --&gt;
    &lt;/supportedLanguages&gt;
  &lt;/exampleElement&gt;
  </code></pre>
  
  <p>Now how can I change attribute 'attr1' and remove attribute 'attr5' in the transformed web.config? I know how to perform the individual transformations:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;exampleElement attr1="true" xdt:Transform="SetAttributes(attr1)"&gt;&lt;/exampleElement&gt;
  </code></pre>
  
  <p>and:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;exampleElement xdt:Transform="RemoveAttributes(attr5)"&gt;&lt;/exampleElement&gt;
  </code></pre>
  
  <p>But I don't know how to combine these transforms. Anybody?</p>
  
  <h3>EDIT:</h3>
  
  <p>Can't answer my own question yet, but the solution seems to be:</p>
  
  <p>
  It seems that it is possible to repeat the same element with different transformations, like so:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
      &lt;exampleElement attr1="true" xdt:Transform="SetAttributes(attr1)"&gt;&lt;/exampleElement&gt;
      &lt;exampleElement xdt:Transform="RemoveAttributes(attr5)"&gt;&lt;/exampleElement&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>As said, this seems to work, but I'm not sure whether this is the intended use of the web.config transformation syntax.</p>