WiX固有のフォーメーションは文書化されていますが、十分なXSLだけを学ぶことは少し難題です。これはあなたを始めるはずです。
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
xmlns:str="http://xsltsl.org/string"
exclude-result-prefixes="wix str"
>
<xsl:output
encoding="utf-8"
method="xml"
version="1.0"
indent="yes"
/>
<xsl:template match='wix:Component[contains(wix:File/@Source, "SourceDir\Prog.exe")]'>
<!-- assumes there is only one Prog.exe -->
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:comment> added shortcut under Component with File that has Source with Prog.exe </xsl:comment>
<!-- Elsewhere, have an Icon element like: <Icon Id="Prog.exe" SourceFile="$(var.BUILDCACHE)Bin/Prog.exe" /> -->
<Shortcut
Id="ProgExeShortcut"
Name="Prog Application"
Icon="Prog.exe"
Directory="ProgramMenuFolder_ProgVendor"
Advertise="yes">
<xsl:attribute name="WorkingDirectory"><xsl:value-of select="@Directory"/></xsl:attribute>
</Shortcut>
<RemoveFolder
Id="ProgExeShortcut_ProgramMenuFolder_ProgVendor"
Directory="ProgramMenuFolder_ProgVendor"
On="uninstall" />
</xsl:copy>
</xsl:template>
<!-- identity template -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match='/'>
<xsl:comment>*** DO NOT EDIT: Generated by heat.exe; transformed by ProgComponentGroup.xsl</xsl:comment>
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
</xsl:stylesheet>
より具体的で以前のテンプレートは、より一般的なものや後のものよりも前にマッチします。したがって、基本は、変更したいものを除き、すべての要素、属性、テキスト、コメントをそのままコピーすることです。変更する要素については、すべての要素を再構成します。この場合は、Component要素のすべてをコピーしてから、Shortcut要素とRemoveFolder要素を追加します。