【发布时间】:2013-01-04 09:08:52
【问题描述】:
我想使用 xslt 来编辑 wix 中 heat 生成的 .wxs 文件
这是 components_en_us.wxs
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="CLASSES">
<Directory Id="dirAB609E465A12655D740B32B2BA26C468" Name="alfresco">
<Directory Id="dir68A1A3CC25353B021B1D7D979B520AF0" Name="extension">
<Component Id="cmp0FAE663628DD6BAE53501BB26264259B" Guid="1CBE6568-96E5-4844-BF02-99AF0DE1719D">
<File Id="fil867FDB2D2761B5912BA54F92F5E928D1" KeyPath="yes" Source="SourceDir\alfresco\extension\web-client-config-custom.xml" />
</Component>
</Directory>
</Directory>
</DirectoryRef>
</Fragment>
</Wix>
但问题是我有其他 .wxs 文件(对于其他语言,components_xx_yy.wxs)并且组件/文件 ID 是相同的。如果我用这种方法编译会报错
error LGHT0091 : Duplicate symbol 'Component:cmp0FAE663628DD6BAE53501BB26264259B' found.
This typically me ans that an Id is duplicated. Check to make sure all your identifiers
of a given type (File, Component, Feature) are unique.
我google了一下,发现可以使用xslt来改变components_en_us.wxs中的Component/File id
所以,我期待类似的东西
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="CLASSES">
<Directory Id="dirAB609E465A12655D740B32B2BA26C468" Name="alfresco">
<Directory Id="dir68A1A3CC25353B021B1D7D979B520AF0" Name="extension">
<Component Id="en_US_cmp0FAE663628DD6BAE53501BB26264259B" Guid="1CBE6568-96E5-4844-BF02-99AF0DE1719D">
<File Id="fil867FDB2D2761B5912BA54F92F5E928D1" KeyPath="yes" Source="SourceDir\alfresco\extension\web-client-config-custom.xml" />
</Component>
</Directory>
</Directory>
</DirectoryRef>
</Fragment>
</Wix>
现在,我从另一个问题获得了这个 xslt,但我不知道如何按照我的意愿实现它。
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl"
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
所以,如果我的理解有误,请纠正我,也请帮助我处理 .xslt
提前致谢
编辑:这种方式是最佳做法,还是我应该做其他事情来解决这个重复错误。
【问题讨论】:
标签: xml xslt wix windows-installer heat