-
Notifications
You must be signed in to change notification settings - Fork 289
/
FixFragment_HKCU.xslt
executable file
·83 lines (71 loc) · 3.05 KB
/
FixFragment_HKCU.xslt
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:w="http://schemas.microsoft.com/wix/2006/wi">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<!-- Identity template -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="/w:Wix" >
<w:Wix>
<xsl:apply-templates select="w:Fragment" />
</w:Wix>
</xsl:template>
<xsl:template match="w:Fragment" >
<w:Fragment>
<xsl:apply-templates select="w:DirectoryRef" />
<xsl:apply-templates select="w:ComponentGroup"/>
</w:Fragment>
</xsl:template>
<xsl:template match="/w:Wix/w:Fragment/w:DirectoryRef">
<w:DirectoryRef Id="{@Id}" />
</xsl:template>
<xsl:template match="w:Component">
<w:Component Id="{@Id}" Guid="{@Guid}" Directory="{@Directory}">
<xsl:apply-templates select="w:File" />
<xsl:apply-templates select="w:ProgId" />
<xsl:apply-templates select="w:RegistryValue" />
</w:Component>
</xsl:template>
<xsl:template match="w:TypeLib">
<w:TypeLib Id="{@Id}" Description="{@Description}" HelpDirectory="{@HelpDirectory}" Language="{@Language}" MajorVersion="{@MajorVersion}" MinorVersion="{@MinorVersion}">
<xsl:apply-templates select="*" />
</w:TypeLib>
</xsl:template>
<xsl:template match="w:File">
<w:File Id="{@Id}" Source="{@Source}">
<xsl:apply-templates select="w:TypeLib" />
</w:File>
</xsl:template>
<xsl:template match="w:RegistryValue">
<w:RegistryValue Key="{@Key}" Value="{@Value}" Type="{@Type}" Action="{@Action}">
<xsl:if test="@Name != ''"> <xsl:attribute name="Name"> <xsl:value-of select="@Name" /> </xsl:attribute> </xsl:if>
<xsl:if test="@Id != ''"> <xsl:attribute name="Id"> <xsl:value-of select="@Id" /> </xsl:attribute> </xsl:if>
<xsl:choose>
<xsl:when test="@Root='HKLM'">
<xsl:attribute name="Root">HKCU</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="Root"><xsl:value-of select="@Root" /></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@Name = 'Path'">
<xsl:attribute name="KeyPath">yes</xsl:attribute>
</xsl:if>
</w:RegistryValue>
</xsl:template>
<xsl:template match="w:ComponentGroup">
<w:ComponentGroup Id="{@Id}">
<xsl:apply-templates select="w:Component"/>
<!-- Intersection in XSLT 1.0 (Michael Kay) -->
</w:ComponentGroup>
</xsl:template>
<xsl:template match="w:ComponentRef">
<w:ComponentRef Id="{@Id}"/>
</xsl:template>
</xsl:stylesheet>