How can I get from this:
<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>
to this:
<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开发者_C百科 Id="{89FF44C6-979D-49B6-AF56-EC9509001DE4}" />
</TypeLib>
</File>
</Component>
</Include>
(move <TypeLib>
s inside <File>
...)
Thanks,
<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>
Result:
<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>
This works like this:
- the identity template (the first one) does explicitly exclude
<TypeLib>
children - a custom template handles
<File>
nodes, nesting all the following<TypeLib>
nodes, i.e. making them children of<File>
- this invokes the identity template for
<TypeLib>
nodes, which now perfectly copies them
精彩评论