使用Wix Toolset(版本3.8)实用程序收获来生成安装程序xml文件。我们希望使用xslt选项删除包含所有文件的文件夹以及对这些文件的任何引用。后一部分证明是困难的;通过引用删除元素
这里是xml的一部分;
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="INSTALL_ROOT">
<Directory Id="..." Name="MyCompany">
<Directory Id=".." Name="doc">
<Component Id="cmp20762D2CAD925E1B5974A3DD938BD5F3" Guid="..">
<File Id=".." KeyPath="yes" Source="index.html" />
</Component>
<Component Id="cmp1BE839006D9CC9F26ECCBEE5894EFC33" Guid="...">
<File Id=".." KeyPath="yes" Source="logo.jpg" />
</Component>
</Directory>
</Directory>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="Features">
<ComponentRef Id="cmp20762D2CAD925E1B5974A3DD938BD5F3" />
<ComponentRef Id="cmp1BE839006D9CC9F26ECCBEE5894EFC33" />
</ComponentGroup>
</Fragment>
</Wix>
使用这个XSLT我能够去掉“文档”字典包含的子元素,但我怎么删除其参考的子组件id属性ComponentRef?
<?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">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node() | @*" name="identity">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="wix:Directory[@Name='doc']" />
</xsl:stylesheet>
@ user2936494:我看到您已将我的解决方案复制到另一个答案。这对Stackoverflow不是很有帮助。相反,请留下评论我的答案,并接受它(标记在左边的勾号),如果它解决了你的问题。 –