ITPub博客

首页 > Linux操作系统 > Linux操作系统 > XML Document Transformation

XML Document Transformation

原创 Linux操作系统 作者:journer 时间:2010-07-01 14:06:01 0 删除 编辑

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-->

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 條件式所支援的轉換方式:

 

下列是 XML Document Transformation 的 Transform. 代換動詞:

 

 

 

3.JPG

4.JPG

5.JPG

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

请登录后发表评论 登录
全部评论

注册时间:2010-05-19

  • 博文量
    5
  • 访问量
    8252