title: How would I dynamically add a new XML node based on the values of other nodes?
body: <p><strong>Background:</strong><br>
  I have an old web CMS that stored content in XML files, one XML file per page. I am in the process of importing content from that CMS into a new one, and I know I'm going to need to massage the existing XML in order for the import process to work properly.</p>
  
  <p>Existing XML:</p>
  
  <pre><code>&lt;page&gt;
      &lt;audience1&gt;true&lt;/audience&gt;
      &lt;audience2&gt;false&lt;/audience&gt;
      &lt;audience3&gt;true&lt;/audience&gt;
      &lt;audience4&gt;false&lt;/audience&gt;
      &lt;audience5&gt;true&lt;/audience&gt;
  &lt;/page&gt;
  </code></pre>
  
  <p>Desired XML:</p>
  
  <pre><code>&lt;page&gt;
      &lt;audience1&gt;true&lt;/audience&gt;
      &lt;audience2&gt;false&lt;/audience&gt;
      &lt;audience3&gt;true&lt;/audience&gt;
      &lt;audience4&gt;false&lt;/audience&gt;
      &lt;audience5&gt;true&lt;/audience&gt;
      &lt;audiences&gt;1,3,5&lt;/audiences&gt;
  &lt;/page&gt;
  </code></pre>
  
  <p><strong>Question:</strong><br>
  The desired XML adds the  node, with a comma-delimited list of the other nodes that have a "true" value. I need to achieve the desired XML for several files, so what is the best way to accomplish this? Some of my ideas:</p>
  
  <ul>
  <li>Use a text editor with a regex find/replace. But what expression? I wouldn't even know where to begin.</li>
  <li>Use a programming language like ASP.NET to parse the files and append the desired node. Again, not sure where to begin here as my .NET skills are only average.</li>
  </ul>
  
  <p>Suggestions?</p>