我使用的维克斯安装收获的文件的文件XSLT转换。 我想,以纪念特定的目录作为永久的所有文件。 为了做到这一点,我必须做一个包含看看文件夹名称为源属性。 下面是其中一个节点,然后变换。 任何帮助将不胜感激。
<Component Id="cmpE4293ADC65367393D7A7630023A43F89" Directory="dirAFEA15D2A28EA2E6080FAD1EE1935E0A" Guid="{691DB98F-E5F4-4979-B2E5-63E14AF8A328}">
<File Id="filE11EC7DCDC230815BECFE0925B1F3DC4" KeyPath="yes" Source="$(var.publishDir)\WebConfig\appSettings.config" />
</Component>
<?xml version="1.0" encoding="UTF-8"?>
<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"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="wix">
<xsl:template match="wix:Wix">
<xsl:copy>
<xsl:apply-templates select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="wix:Component">
<!-- Just copy the tag itself -->
<xsl:copy>
<xsl:variable name="fvsys" >
<xsl:value-of select="node()/File/@Source"/>
</xsl:variable>
<!-- Copy all attributes -->
<xsl:apply-templates select="@*" />
<!-- Here comes the distinction: if you find our special component, do some special things -->
<xsl:choose>
<!-- Note that the string is translated to all lower case, so you don't have to care about being case sensitive or not -->
<xsl:when test="contains($fvsys, 'WebConfig')">
<!-- Here we will add the Permanent-attribute to this very special component -->
<xsl:attribute name="Permanent">yes</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:choose>
<!-- Note that the string is translated to all lower case, so you don't have to care about being case sensitive or not -->
<xsl:when test="contains($fvsys, 'DocumentConversions')">
<!-- Here we will add the Permanent-attribute to this very special component -->
<xsl:attribute name="Permanent">yes</xsl:attribute>
</xsl:when>
</xsl:choose>
<!-- Now take the rest of the inner tag -->
<xsl:apply-templates select="node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>