zoukankan      html  css  js  c++  java
  • wix xslt for adding node

    Using xslt to add new node item to wix source code.

    Original wix code:

      <Fragment>
        <DirectoryRef Id="TARGETDIR">
          <Component Guid="*" Id="Test.txt">
            <File KeyPath="yes" Source="$(var.TestFolder)Test.txt" Id="Test.txt" />
          </Component>
        </DirectoryRef>
      </Fragment>

    Add <CopyFile /> node inside <File> node, the expected wix code would be:

      <Fragment>
        <DirectoryRef Id="TARGETDIR">
          <Component Guid="*" Id="Test.txt">
            <File KeyPath="yes" Source="$(var.TestFolder)Test.txt" Id="Test.txt" >
              <CopyFile Id ="Test.txt" DestinationProperty="BinFolder" DestinationName="test.txt" />
            </File>
          </Component>
        </DirectoryRef>
      </Fragment>

    Pass this xslt to heat.exe with -t option should do the work:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:wi="http://schemas.microsoft.com/wix/2006/wi" exclude-result-prefixes="wi">
      <xsl:output method="xml" indent="yes"/>
    
      <xsl:template match="@* | node()">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="wi:File">
        <xsl:copy>
          <xsl:variable name="leadingSpace" select="preceding-sibling::text()[1]" />
          <xsl:apply-templates select="@*"/>
          <!-- Add linebreak and indentation, as requested in the comments -->
          <xsl:value-of select="concat($leadingSpace, '    ')" />
          <CopyFile xmlns="http://schemas.microsoft.com/wix/2006/wi" Id="Test.txt" DestinationProperty="BinFolder" DestinationName="test.txt"/>
          <!-- Linebreak and indentation -->
          <xsl:value-of select="$leadingSpace"/>
        </xsl:copy>
      </xsl:template>
    
    </xsl:stylesheet>
  • 相关阅读:
    matlab cell
    matlab linux 快捷键设置——有问题还是要解决
    latex 小结
    TOJ 1258 Very Simple Counting
    TOJ 2888 Pearls
    HDU 1248 寒冰王座
    TOJ 3486 Divisibility
    TOJ 3635 过山车
    TOJ 1840 Jack Straws
    HDU 4460 Friend Chains
  • 原文地址:https://www.cnblogs.com/cindy-hu-23/p/5036002.html
Copyright © 2011-2022 走看看