-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathProduct-discover-files-config.xsl
48 lines (38 loc) · 1.9 KB
/
Product-discover-files-config.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="utf-8"?>
<!-- Adapted from http://www.lines-davies.net/blog/?p=12 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<!--Identity Transform -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!--key to detect conf/minion file -->
<!-- ends-with WORKAROUND substring(A, length(A) - length(B) + 1) -->
<xsl:key name="conf_minion_key" match="wix:Component['conf\minion' = substring(wix:File/@Source, string-length(wix:File/@Source) - 10)]" use="@Id"/>
<!--Remove the Guid, so conf/minion is left behind on UNINSTALL -->
<xsl:template match="wix:Component[key('conf_minion_key', @Id)]">
<xsl:copy>
<xsl:attribute name="Guid">
<xsl:value-of select="''"/>
</xsl:attribute>
<xsl:apply-templates select="@*[local-name()!='Guid']|node()"/>
</xsl:copy>
</xsl:template>
<!-- This is the XSL madness copied for the case you harvest not ROOTDIR but CONFDIR -->
<!--key to detect minion file -->
<!-- ends-with WORKAROUND substring(A, length(A) - length(B) + 1) -->
<xsl:key name="conf_minion_key2" match="wix:Component['minion' = substring(wix:File/@Source, string-length(wix:File/@Source) - 5)]" use="@Id"/>
<!--Remove the Guid, so minion is left behind on UNINSTALL -->
<xsl:template match="wix:Component[key('conf_minion_key2', @Id)]">
<xsl:copy>
<xsl:attribute name="Guid">
<xsl:value-of select="''"/>
</xsl:attribute>
<xsl:apply-templates select="@*[local-name()!='Guid']|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>