WiX XSLT for adding node

Source: Internet
Author: User
Tags xsl xslt

Using XSLT to add new node item to WiX source code.

Original WiX Code:

  <Fragment>    <DirectoryrefId= "TARGETDIR">      <ComponentGuid="*"Id= "Test.txt">        <FileKeyPath= "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>    <DirectoryrefId= "TARGETDIR">      <ComponentGuid="*"Id= "Test.txt">        <FileKeyPath= "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 does the work:

<Xsl:stylesheetversion= "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:outputMethod= "xml"Indent= "Yes"/>  <xsl:templateMatch= "@* | Node ()">    <xsl:copy>      <xsl:apply-templatesSelect= "@* | Node ()"/>    </xsl:copy>  </xsl:template>  <xsl:templateMatch= "Wi:file">    <xsl:copy>      <xsl:variablename= "Leadingspace"Select= "Preceding-sibling::text () [1]" />      <xsl:apply-templatesSelect="@*"/>      <!--Add linebreak and indentation, as requested in the comments -      <xsl:value-ofSelect= "concat ($leadingSpace, ')" />      <CopyFilexmlns= "Http://schemas.microsoft.com/wix/2006/wi"Id= "Test.txt"Destinationproperty= "Binfolder"Destinationname= "Test.txt"/>      <!--Linebreak and Indentation -      <xsl:value-ofSelect= "$leadingSpace"/>    </xsl:copy>  </xsl:template></Xsl:stylesheet>

WiX XSLT for adding node

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.