Comments (5)
I gave up using this library, currently I am using the linq to xml to migrate the configuration file.
from fatantelope.
I'm experiencing the same issue
<configuration>
<appSettings>
<add key="KeyA" value="ValueA" />
</appSettings>
</configuration>
Target web.config
<configuration>
<appSettings>
<add key="KeyB" value="ValueB" />
<add key="KeyC" value="ValueC" />
</appSettings>
</configuration>
Transformation
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add xdt:Locator="Condition([(@key='KeyB')])" value="ValueB" xdt:Transform="Replace(value)" />
<add key="KeyC" value="ValueC" xdt:Transform="Insert" />
</appSettings>
</configuration>
Again i believe the condition should be xdt:Locator="Condition([(@value='KeyA')])"? It seens like an issue when the transform should remove a lonely leaf node and add new..
from fatantelope.
Hi All,
I've put up a fix now. Apologies for the delay in addressing this - dad life got in the way and then it fell off the radar. It's a tricky one, the xdt:Locator needs to be valid for the current state of the transformed document. And you can omit the xdt:Locator altogether if there is only one node with that name. So after this fix the working patch for @myasoex example looks like:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add value="1" xdt:Transform="SetAttributes(value)" />
<add key="MyService.Api" value="2" xdt:Transform="Insert" />
</appSettings>
</configuration>
And similarly for your example @Hans-MartinHannibalLauridsen , the working generated patch doesn't include an xdt:Locator:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="KeyB" value="ValueB" xdt:Transform="Replace" />
<add key="KeyC" value="ValueC" xdt:Transform="Insert" />
</appSettings>
</configuration>
I'll package up and push into nuget shortly.
Cheers,
Cameron
from fatantelope.
Thanks, much obliged😀
from fatantelope.
Closing as I think that change has addressed the issue?
from fatantelope.
Related Issues (11)
- NPE at XdtDiffWriter: line 409 HOT 1
- XPath in an InsertBefore transform is using a trait of the parent node that's been transformed into something else HOT 2
- Deploy command line tool with NuGet dist HOT 3
- Case error in generated XDT HOT 1
- the application is erroring out requiring a clear node in the source HOT 24
- Microsoft.Web.XmlTransform.XmlNodeException: No element in the source document matches HOT 8
- Wrong patch file generated when the attribute has xml namespace
- remove namespace xdt did not work HOT 2
- Use Insert instead of InsertBefore when the delta only exist in target HOT 1
- Error when creating Transformed File HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fatantelope.