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>

wix xslt for adding node的更多相关文章

  1. 在openshift上自定义node.js的版本

    https://github.com/ramr/nodejs-custom-version-openshift 由于是线上服务器,一步一步来: 先把上面的工程拉下来,覆盖到初始化的工程里,提交,让服务 ...

  2. Using XSLT and Open XML to Create a Word 2007 Document

    Summary: Learn how to transform XML data into a Word 2007 document by starting with an existing docu ...

  3. redis 学习笔记(6)-cluster集群搭建

    上次写redis的学习笔记还是2014年,一转眼已经快2年过去了,在段时间里,redis最大的变化之一就是cluster功能的正式发布,以前要搞redis集群,得借助一致性hash来自己搞shardi ...

  4. Redis集群研究和实践(基于redis 3.0.5)

    前言 redis 是我们目前大规模使用的缓存中间件,由于它强大高效而又便捷的功能,得到了广泛的使用.现在的2.x的稳定版本是2.8.19,也是我们项目中普遍用到的版本. redis在年初发布了3.0. ...

  5. 分布式缓存技术redis学习系列(四)——redis高级应用(集群搭建、集群分区原理、集群操作)

    本文是redis学习系列的第四篇,前面我们学习了redis的数据结构和一些高级特性,点击下面链接可回看 <详细讲解redis数据结构(内存模型)以及常用命令> <redis高级应用( ...

  6. ocfs2: 搭建环境

    OCFS2是基于共享磁盘的集群文件系统,它在一块共享磁盘上创建OCFS2文件系统,让集群中的其它节点可以对磁盘进行读写操作.OCFS2由两部分内容构成,一部分实现文件系统功能,位于VFS之下和Ext4 ...

  7. redis集群配置

    客户端分片 程序端实现 代理proxy,访问proxy,proxy指定redis保存位置. Twemproxy Redis cluster ,会造成一部分数据丢失,无中心化1.将数据自动切分(spli ...

  8. memcache的一致性hash算法使用

    一.概述 1.我们的memcache客户端(这里我看的spymemcache的源码),使用了一致性hash算法ketama进行数据存储节点的选择.与常规的hash算法思路不同,只是对我们要存储数据的k ...

  9. redis3.0 集群实战2 - 集群功能实战

    1 集群基本操作   1.1 查看当前集群状态 使用redis-trib.rb check功能查看对应的节点的状态: [root@bogon bin]# ./redis-trib.rb check 1 ...

随机推荐

  1. win7配置nginx+php步骤

    1.下载nginx: http://www.nginx.cn/nginx-download 2.下载php : http://www.php.net/downloads.php  (线程安全与非安全参 ...

  2. 架构设计:负载均衡层设计方案(7)——LVS + Keepalived + Nginx安装及配置

    1.概述 上篇文章<架构设计:负载均衡层设计方案(6)——Nginx + Keepalived构建高可用的负载层>(http://blog.csdn.net/yinwenjie/artic ...

  3. Javascript Date原型方法

    // 对Date的扩展,将 Date 转化为指定格式的String // 月(M).日(d).小时(h).分(m).秒(s).季度(q) 可以用 1-2 个占位符, // 年(y)可以用 1-4 个占 ...

  4. JavaScript 之 执行前台函数

    1.OnClientClick (vs2003不支持这个方法) <asp:Button ID="Button" runat="server" Text=& ...

  5. 让ConfigurationManager打开任意的配置文件

    VisualStudio的配置文件很好很强大,用来保存数据库连接字符串或键值对都非常方便,只需要通过ConfigurationManager的ConnectionStrings或AppSettings ...

  6. 根据当前IP获取当时所在信息

    现在很多系统,都要在登录时候,确定当前用户所在的位置.这里记录一个C#使用Http的方式获取当前IP所在的位置信息.主要使用的api是新浪的接口. public partial class sina ...

  7. E - 娜娜梦游仙境系列——莫名其妙的插曲

    E - 娜娜梦游仙境系列——莫名其妙的插曲 E - 娜娜梦游仙境系列——莫名其妙的插曲 Time Limit: 2000/1000MS (Java/Others)    Memory Limit: 1 ...

  8. Nodejs新建博客练习(一)安装express并新建项目

    安装express npm install -g express-generator 新建工程 express blog //新建项目 cd blog && npm install / ...

  9. 重构23-Introduce Parameter Object(参数对象)

    有 时当 使用 一个 包含 多 个 参 数 的 方 法 时 , 由 于参 数 过 多 会 导 致 可 读 性 严 重 下 降 , 如 : 有 时当 使用 一个 包含 多 个 参 数 的 方 法 时 , ...

  10. css 所有选择器

    选择器 例子 例子描述 CSS .class .intro 选择 class="intro" 的所有元素. 1 #id #firstname 选择 id="firstna ...