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-->
<?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 條件式所支援的轉換方式:
下列是 XML Document Transformation 的 Transform. 代換動詞:
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/550904/viewspace-666822/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/550904/viewspace-666822/