Преобразование сгенерированного Heat .wxs с помощью XSLT (добавьте RegistryValue и измените некоторые значения)

Это мой желаемый результат:

<Component Id="C_SOMEFILE" Guid="some-guid-here">
    <File Id="File_SOMEFILE" Source="$(var.Source)\SOMEFILE" KeyPath="no" />
    <RegistryValue Root="HKCU" Key="Software\Product" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>

Это мой XSLT-файл:

<xsl:stylesheet version="1.0" 
                            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                            xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
                            xmlns="http://schemas.microsoft.com/wix/2006/wi"
                            exclude-result-prefixes="xsl wix">

<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />

<xsl:strip-space elements="*"/>

<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<!--Set KeyPath to NO-->
<xsl:template match='wix:File[@Id]'>
    <xsl:copy>
        <xsl:apply-templates select="@*"/>
        <xsl:attribute name="KeyPath">
            <xsl:text>no</xsl:text>
        </xsl:attribute>
    </xsl:copy>
</xsl:template>

<xsl:template match="wix:Component/wix:File">
    <xsl:copy-of select="." />
    <RegistryValue Root="HKCU" Key="Software\Product" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</xsl:template>

<!--Give Compoentent ID prefix C_-->
<xsl:template match="wix:Component/@Id">
    <xsl:attribute name="{name()}">
        <xsl:value-of select="concat('C_', .)" />
    </xsl:attribute>
</xsl:template>

<!--Give Componentref ID prefix C_-->
<xsl:template match="wix:ComponentRef/@Id">
    <xsl:attribute name="{name()}">
        <xsl:value-of select="concat('C_', .)" />
    </xsl:attribute>
</xsl:template>

<!--Give Directory ID prefix Dir_-->
<xsl:template match="wix:Directory/@Id">
    <xsl:attribute name="{name()}">
        <xsl:value-of select="concat('Dir_', .)" />
    </xsl:attribute>
</xsl:template>

<!--Give File ID prefix File_-->
<xsl:template match="wix:File/@Id">
    <xsl:attribute name="{name()}">
        <xsl:value-of select="concat('File_', .)" />
    </xsl:attribute>
</xsl:template>

И это мой вывод с использованием этого XSL:

<Component Id="C_SOMEFILE" Guid="some-guid-here">
    <File Id="SOMEFILE" KeyPath="yes" Source="$(var.Source)\SOMEFILE" />
    <RegistryValue Root="HKCU" Key="Software\Product" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>

Как только я активирую

<xsl:template match="wix:Component/wix:File">
   <xsl:copy-of select="." />
   <RegistryValue Root="HKCU" Key="Software\Product" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</xsl:template>

Изменения файлов в XSL не применяются, например, добавьте префикс, измените keypath на no, если я удалю тот, который добавляет реестр, изменения файла будут работать как шарм!

Что я делаю не так?

Спасибо за любую помощь, спасибо.

ОБНОВИТЬ: Вот оригинальный пример XML без преобразования:

    <?xml version="1.0" encoding="utf-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
       <Fragment>
          <DirectoryRef Id="Dir_Exentsions">
              <Directory Id="SOMEFILE" Name="SOMEFILE">
                 <Component Id="SOMEFILE" Guid="7D8FDF2D-CED9-4A08-A57E-96CD7FFA8E9A">
                    <File Id="SOMEFILE" KeyPath="yes" Source="$(var.Source)\SOMEFILE" />
                 </Component>          
              </Directory>
          </DirectoryRef>
       </Fragment>
     </Wix>

Ответы на вопрос(1)

Ваш ответ на вопрос