20131108 Web.config transformation_syntax by jax

347 views
246 views

Published on

Web.config Transformation_syntax by Jax

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
347
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

20131108 Web.config transformation_syntax by jax

  1. 1. XML Transformation Syntax by Jax
  2. 2. • Locator Attribute Syntax – Condition – Match – XPath • Transform Attribute Syntax – – – – – – – – Replace Insert InsertBefore InsertAfter Remove RemoveAll RemoveAttributes SetAttributes
  3. 3. Sample <?xml version="1.0"?> <configuration> <appSettings> <add key="appName" value="Test-Project" /> </appSettings> </configuration> <?xml version="1.0" encoding="utf-8" ?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <appSettings> <add key="appName" value="Publish-Project" xdt:Transform="Replace" xdt:Locator="Match(key)" /> </appSettings> </configuration>
  4. 4. Locator Attribute Syntax <add key="appName" value="Publish-Project" xdt:Transform="Replace" xdt:Locator="Condition(@key='appName' or @key='appTitle')” /> <add key="appName"           value="Publish-Project"           xdt:Transform="Replace"           xdt:Locator="Match(key)"  /> <add key="appName"           value="Publish-Project"           xdt:Transform="Replace"           xdt:Locator="XPath(configuration/appSettings[@name='appName'])"  />
  5. 5. Transform Attribute Syntax <add key="appName“ value="Publish-Project“ xdt:Transform="Replace“ xdt:Locator="Match(key)" /> <add key="appName“ value="Publish-Project“ xdt:Transform=“Insert“ /> <add key="appName“ value="Publish-Project“ xdt:Transform=“InsertBefore(/configuration/appSettings/add[@key=‘site‘])" /> <add key="appName“ value="Publish-Project“ xdt:Transform=“InsertAfter(/configuration/appSettings/add[@key=‘site‘])" />
  6. 6. <add key="appName“ xdt:Transform=“Remove“ xdt:Locator="Match(key)" /> <add key="appName“ xdt:Transform=“RemoveAll“ xdt:Locator="Match(key)" /> <add xdt:Transform=“RemoveAll“ /> <add key="appName" xdt:Transform="RemoveAttributes(debug,batch)" xdt:Locator="Match(key)" /> <add key="appName" desc="Project Description" xdt:Transform="SetAttributes(desc)" xdt:Locator="Match(key)" />
  7. 7. 參考來源 Web.config Transformation Syntax for Web Project Deployment Using Visual Studio http://msdn.microsoft.com/en-us/library/dd465326.aspx

×