首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用XSLT从heat修改.wxs

使用XSLT从heat修改.wxs
EN

Stack Overflow用户
提问于 2013-01-21 18:19:46
回答 1查看 1.3K关注 0票数 2

我想用xslt来编辑由wix中的heat生成的.wxs文件。

这是components_en_us.wxs

代码语言:javascript
复制
<?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是相同的。如果我使用这个方法进行编译,我会得到一个错误

代码语言:javascript
复制
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

所以,我希望是这样的

代码语言:javascript
复制
<?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,但我不知道如何按我想要的方式实现它。

代码语言:javascript
复制
<?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

提前感谢

编辑:这是最好的做法,还是我应该做一些其他的事情来解决这个重复错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-01-21 18:28:05

我能在这两个XML清单之间找到的唯一变化是在组件ID之前添加了"en_US_“。如果是,请尝试将此模板添加到当前的XSLT文件中:

代码语言:javascript
复制
<xsl:template match="wix:Component/@Id">
   <xsl:attribute name="{name()}">
     <xsl:value-of select="concat('en_US_', .)" />
   </xsl:attribute>
</xsl:template>
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14436495

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档