title: Using XSL compare two files and generate an output file
body: <p>Using XSL I want to compare two file and generate an output file.</p>
  
  <p><strong>File 1:</strong></p>
  
  <pre><code>&lt;SalesExtractProcess&gt;
    &lt;PackageFormatVersion&gt;3&lt;/PackageFormatVersion&gt;
    &lt;VersionComments&gt;&lt;/VersionComments&gt;
    &lt;CreatorName&gt;Demouser&lt;/CreatorName&gt;
    &lt;CreatorComputerName&gt;DemoComputer&lt;/CreatorComputerName&gt;
    &lt;CreationDate&gt;10/1/2012 9:00:09 AM&lt;/CreationDate&gt;
    &lt;PackageType&gt;5&lt;/PackageType&gt;
    &lt;Configurations&gt;
      &lt;SalesConfigurations&gt;
        &lt;ConfigurationType&gt;1&lt;/ConfigurationType&gt;
        &lt;ConfigurationString&gt;SalesExtractPackageConfig.dtsConfig&lt;/ConfigurationString&gt;
        &lt;ConfigurationVariable&gt;&lt;/ConfigurationVariable&gt;
      &lt;/SalesConfigurations&gt;
    &lt;/Configurations&gt;
  &lt;SalesExtractProcess&gt;
  </code></pre>
  
  <p><strong>File 2:</strong></p>
  
  <pre><code>&lt;Package&gt;
      &lt;PackageFormatVersion checked="false"&gt;3&lt;/PackageFormatVersion&gt;
      &lt;VersionComments checked="false"&gt;&lt;/VersionComments&gt;
      &lt;CreatorName checked="true"&gt;Testuser&lt;/CreatorName&gt;
      &lt;CreatorComputerName checked="true"&gt;TestComputer&lt;/CreatorComputerName&gt;
      &lt;CreationDate checked="true"&gt;10/1/2012 9:00:09 AM&lt;/CreationDate&gt;
      &lt;PackageType checked="false"&gt;5&lt;/PackageType&gt;
      &lt;Configurations&gt;
          &lt;Config&gt;
              &lt;ConfigurationType checked="false"&gt;1&lt;/ConfigurationType&gt;
              &lt;ConfigurationString checked="true"&gt;Package.dtsConfig&lt;/ConfigurationString&gt;
              &lt;ConfigurationVariable checked="false"&gt;&lt;/ConfigurationVariable&gt;
          &lt;/Config&gt;
      &lt;/Configurations&gt;
  &lt;Connections&gt;
      &lt;LocalHost.AdventureWorks&gt;
          &lt;ObjectName  checked="true"&gt;LocalHost.AdventureWorks&lt;/ObjectName&gt;
      &lt;/LocalHost.AdventureWorks&gt;
  &lt;/Connections&gt;
  &lt;/Package&gt;  
  </code></pre>
  
  <p>I want to compare File 1 with File 2 and from File 1 output all matching nodes (irrespective of path) with attribute <strong>checked="true"</strong> to result file. My result file should look like</p>
  
  <p><strong>Result File :</strong></p>
  
  <pre><code>&lt;SalesExtractProcess&gt;
      &lt;CreatorName&gt;Demouser&lt;/CreatorName&gt;
      &lt;CreatorComputerName&gt;DemoComputer&lt;/CreatorComputerName&gt;
      &lt;CreationDate&gt;10/1/2012 9:00:09 AM&lt;/CreationDate&gt;
      &lt;Configurations&gt;
        &lt;SalesConfigurations&gt;
           &lt;ConfigurationString&gt;SalesExtractPackageConfig.dtsConfig&lt;/ConfigurationString&gt;
        &lt;/SalesConfigurations&gt;
      &lt;/Configurations&gt;
  &lt;SalesExtractProcess&gt;
  </code></pre>
  
  <p>I couldnt figure out how to create xsl for this task. Any help would be appreciated.</p>