Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 创建转换(XSL)以修改热量(WiX)输出_Xml_Xslt_Wix - Fatal编程技术网

Xml 创建转换(XSL)以修改热量(WiX)输出

Xml 创建转换(XSL)以修改热量(WiX)输出,xml,xslt,wix,Xml,Xslt,Wix,我正在尝试转换输出热量(WiX) 使用此XSLT文件 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <!-- copy everything verbatim -->

我正在尝试转换输出热量(WiX)


使用此XSLT文件

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" indent="yes"/>

  <!-- copy everything verbatim -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>

  <!-- except "Component" nodes -->
  <xsl:template match="Component">
    <xsl:copy>
      <xsl:attribute name="Id">
        <xsl:value-of select="concat('WinServ_', @Id)"/>
      </xsl:attribute>
      <xsl:apply-templates select="*" />

    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

但它不起作用。我想要的是在所有组件节点的Id属性的值后面附加一个前缀(例如WinServ)。应用XSLT后,输出与输入相同

怎么了

致意

最终解决方案 多亏了Tim和Tom,我终于得到了我想要的东西:一个XSL转换,将它附加到一些输出表单Heat(WiX)中,以避免Id冲突。这是最后一个XSLT文件(还有其他类似文件)


您尚未在XSLT中说明wix名称空间。在WIXXML中,所有元素都在一个名称空间中,正如根元素上的默认名称空间元素所声明的那样

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

注意,
wix
前缀的使用在这里是任意的。它可以是您选择的任何内容,只要名称空间uri匹配即可。

您可能还需要
,或者,如果您不需要,请删除所有
组件组
元素。是的,Tom,您是对的,非常感谢。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
  <xsl:output method="xml" indent="yes"/>

  <!-- copy everything verbatim -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>

  <!-- except "Component" nodes -->
  <xsl:template match="wix:Component|wix:ComponentRef|wix:File">
    <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:attribute name="Id">
        <xsl:value-of select="concat('WebApp_', @Id)"/>
      </xsl:attribute>
      <xsl:apply-templates select="child::*" />
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
      xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
  <xsl:output method="xml" indent="yes"/>

  <!-- copy everything verbatim -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>

  <!-- except "Component" nodes -->
  <xsl:template match="wix:Component">
    <xsl:copy>
      <xsl:attribute name="Id">
        <xsl:value-of select="concat('WinServ_', @Id)"/>
      </xsl:attribute>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>