我如何从中得到:
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Component Feature="toplevel">
<File Id="fil8A88F8B155E29670FCA1B83F0E99E635" />
<TypeLib Id="{DC88F377-25DD-49C8-99D9-1FD8AE484362}" >
<Interface Id="{5D12ED70-0B5A-49C4-A8A3-FC4C209295BA}" />
<Interface Id="{73E8EDB7-4293-496D-8ABD-F973F002A033}" />
</TypeLib>
<TypeLib Id="{F3C9A192-17C2-4E25-ADB9-89FFEEC0403E}">
<Interface Id="{89FF44C6-979D-49B6-AF56-EC9509001DE4}" />
</TypeLib>
</Component>
</Include>
到此:
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Component Feature="toplevel">
<File Id="fil8A88F8B155E29670FCA1B83F0E99E635" >
<TypeLib Id="{DC88F377-25DD-49C8-99D9-1FD8AE484362}" >
<Interface Id="{5D12ED70-0B5A-49C4-A8A3-FC4C209295BA}" />
<Interface Id="{73E8EDB7-4293-496D-8ABD-F973F002A033}" />
</TypeLib>
<TypeLib Id="{F3C9A192-17C2-4E25-ADB9-89FFEEC0403E}">
<Interface Id="{89FF44C6-979D-49B6-AF56-EC9509001DE4}" />
</TypeLib>
</File>
</Component>
</Include>
(在<TypeLib>
内移动<File>
...)
谢谢,
答案 0 :(得分:2)
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wi="http://schemas.microsoft.com/wix/2006/wi"
>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node()[not(self::wi:TypeLib)] | @*" />
</xsl:copy>
</xsl:template>
<xsl:template match="wi:File">
<xsl:copy>
<xsl:apply-templates select="node() | @* | following-sibling::wi:TypeLib" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
结果:
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Component Feature="toplevel">
<File Id="fil8A88F8B155E29670FCA1B83F0E99E635">
<TypeLib Id="{DC88F377-25DD-49C8-99D9-1FD8AE484362}">
<Interface Id="{5D12ED70-0B5A-49C4-A8A3-FC4C209295BA}"></Interface>
<Interface Id="{73E8EDB7-4293-496D-8ABD-F973F002A033}"></Interface>
</TypeLib>
<TypeLib Id="{F3C9A192-17C2-4E25-ADB9-89FFEEC0403E}">
<Interface Id="{89FF44C6-979D-49B6-AF56-EC9509001DE4}"></Interface>
</TypeLib>
</File>
</Component>
</Include>
这样的工作原理如下:
<TypeLib>
个孩子<File>
个节点,嵌套所有以下<TypeLib>
个节点,即使其成为<File>
<TypeLib>
节点的身份模板,现在可以完美地复制它们