Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.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
Xslt 在XSL转换中使用Wix变量_Xslt_Wix_Heat - Fatal编程技术网

Xslt 在XSL转换中使用Wix变量

Xslt 在XSL转换中使用Wix变量,xslt,wix,heat,Xslt,Wix,Heat,我正在使用热获取项目文件。但是,由于我希望在目标系统上有快捷方式,因此主可执行文件必须被Heat忽略,并手动添加到主wxs文件中。 我使用以下xsl文件告诉heat忽略我的可执行文件(Aparati.exe) 问题是我不想在这里直接写入文件名,而是想将可执行文件名设置为msbuild文件中的参数(可能是wix变量)。如果有人能告诉我这是怎么可能的,我将非常感激。还有什么其他方法可以解决这个问题呢 经过一些研究,我提出了这个解决方案,它从我的msbuild文件加载应用程序名 <?xml

我正在使用获取项目文件。但是,由于我希望在目标系统上有快捷方式,因此主可执行文件必须被Heat忽略,并手动添加到主wxs文件中。 我使用以下xsl文件告诉heat忽略我的可执行文件(Aparati.exe)



问题是我不想在这里直接写入文件名,而是想将可执行文件名设置为msbuild文件中的参数(可能是wix变量)。如果有人能告诉我这是怎么可能的,我将非常感激。还有什么其他方法可以解决这个问题呢

经过一些研究,我提出了这个解决方案,它从我的msbuild文件加载应用程序名

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
        xmlns:msbuild="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- strip out the exe files from the fragment heat generates. -->

  <xsl:output method="xml" indent="yes" />
  <!-- take the app name from msbuild file -->
  <xsl:param name="appName" select="document('..\build.proj')//msbuild:AppName/text()"/>
  <xsl:param name="exeName" select="concat($appName, '.exe')" />

  <!-- copy all the elements -->
  <xsl:template match="@*|*">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>
  <!-- except for Component and ComponentRef elements which contain the $exeName -->
  <xsl:template match="wix:Component|wix:ComponentRef">
    <xsl:choose>
      <xsl:when test="contains(wix:File/@Source, $exeName)"></xsl:when>
      <xsl:otherwise>
        <xsl:copy>
          <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>

我还查看了Heat源代码,看看它是否支持xslt参数输入,但它似乎还不支持该功能

PS:在热火中,我看到了一些非常丑陋的编码。我希望他们考虑重构源。

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
        xmlns:msbuild="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- strip out the exe files from the fragment heat generates. -->

  <xsl:output method="xml" indent="yes" />
  <!-- take the app name from msbuild file -->
  <xsl:param name="appName" select="document('..\build.proj')//msbuild:AppName/text()"/>
  <xsl:param name="exeName" select="concat($appName, '.exe')" />

  <!-- copy all the elements -->
  <xsl:template match="@*|*">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>
  <!-- except for Component and ComponentRef elements which contain the $exeName -->
  <xsl:template match="wix:Component|wix:ComponentRef">
    <xsl:choose>
      <xsl:when test="contains(wix:File/@Source, $exeName)"></xsl:when>
      <xsl:otherwise>
        <xsl:copy>
          <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>