title: WiX Installer: using xslt with heat.exe to update attributes
body: <p>I am trying to create a WiX installer for a Windows service, and I have read that I need to set the KeyPath to “no” for all my files, with the exception of the .exe in my WiX script. 
  I am currently generating my Directory and file structure using Heat.exe here is my command:</p>
  
  <pre><code>"$(WIX)bin\heat.exe" dir $(SolutionDir)EmailGenerationService\bin\PROD 
                      -cg EmailGenFiles -gg -scom -sreg -sfrag -srd -suid 
                      -dr INSTALLLOCATION -var var.FileSource 
                      -t $(Projectdir)KeyPathTransform.xslt 
                      -out $(ProjectDir)DirectoryAndFileComponents.wxs
  </code></pre>
  
  <p>It is my intention to update all the file elements with <code>Keypath=”no”</code> in my DirectoryAndFileComponents.wxs file. 
  A sample of the output from heat is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"&gt;
    &lt;Fragment&gt;
      &lt;DirectoryRef Id="INSTALLLOCATION"&gt;
        &lt;Component Id="Dollar.Common.dll" Guid="{2BCD0767-2383-47CF-B1BF-325FA4A3264F}"&gt;
          &lt;File Id="Dollar.Common.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.dll" /&gt;
        &lt;/Component&gt;
        &lt;Component Id="Dollar.Common.Exceptions.dll" Guid="{B7238091-76D1-42F5-A3B4-A539DFF3BD92}"&gt;
          &lt;File Id="Dollar.Common.Exceptions.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Exceptions.dll" /&gt;
        &lt;/Component&gt;
        &lt;Component Id="Dollar.Common.Exceptions.pdb" Guid="{43711979-747D-49C9-BAE4-ECD44FAF5E67}"&gt;
          &lt;File Id="Dollar.Common.Exceptions.pdb" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Exceptions.pdb" /&gt;
        &lt;/Component&gt;
        &lt;Component Id="Dollar.Common.Logging.dll" Guid="{59F9ABF3-5F68-410C-BC96-0556282F1E04}"&gt;
          &lt;File Id="Dollar.Common.Logging.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Logging.dll" /&gt;
        &lt;/Component&gt;
  </code></pre>
  
  <p>Here is the XSLT I am passing to heat to perform the transformation:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="1.0" 
              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
              exclude-result-prefixes="msxsl" 
              xmlns:wix="http://schemas.microsoft.com/wix/2006/wix"
              xmlns:my="my:my"&gt;
  
    &lt;xsl:output method="xml" indent="no"/&gt;
  
    &lt;xsl:strip-space elements="*"/&gt;
  
    &lt;xsl:template match="@*|node()"&gt;
      &lt;xsl:copy&gt;
        &lt;xsl:apply-templates select="@*|node()"/&gt;
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
  
    &lt;xsl:template match='/wix:Wix/wix:Fragment/wix:DirectoryRef/wix:Component/wix:File[@Id and not (@Id="EmailGenerationService.exe")]'&gt;
      &lt;xsl:attribute name="KeyPath"&gt;
            &lt;xsl:value-of select="no"/&gt;
      &lt;/xsl:attribute&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I have tried quite a few variations of this based on other posts on this site and else where, but as yet have been unable to get the file created by heat.exe to have KeyPath=”no”.</p>
  
  <p>Am I missing something obvious? </p>