我想使用xslt编辑从wix中的heat
生成的.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.
我搜索了一下,发现我可以使用xslt来更改components-en-us.wxs中的组件/文件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列表之间唯一的变化就是在组件id之前添加了“en_us”。这就是全部吗?如果是,请尝试将此模板添加到当前的xslt文件中:
<xsl:template match="wix:Component/@Id">
<xsl:attribute name="{name()}">
<xsl:value-of select="concat('en_US_', .)" />
</xsl:attribute>
</xsl:template>
关于xml - 使用XSLT修改热源.wxs,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14436495/