XML Document Transformation

XML Document Transformation 說明

 

XML Document Transformation 是一種 XML 文件間的轉換機能,由 MSBuild 工具支援,它可以將指定的 XML 文件中的內容所設定的條件式 (locator) 以及代換動詞 (transform),將來源檔案的元素自動更新到主檔案,例如將 Web.release.config 中的內容代換到 Web.config 中。要支援 XML Document Transformation,則來源檔案必須要引用 http://schemas.microsoft.com/XML-Document-Transform 命名空間,並將前置字元用 xdt 來設定,如:

 

xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

 

接著,要在需處理轉換的元素中,加入代換的條件式,以及執行代換時的動作設定,例如:

 

<!--Web.relase.config--&gt

<?xml version="1.0"?>

xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">


         connectionString="data source=productionServer;Integrated Security=SSPI;Initial Catalog=productionDB"
      
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>

 

下列是 XML Document Transformation Locator 條件式所支援的轉換方式:550904_201007011409151.jpg

 

下列是 XML Document Transformation Transform. 代換動詞:550904_201007011409152.jpg550904_201007011409153.jpg

 

 

 

fj.png3.JPG

fj.png4.JPG

fj.png5.JPG

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/550904/viewspace-666822/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/550904/viewspace-666822/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值