-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Hi,
I have two xml files
base.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="test20180421" value="1" />
<add key="test20180422" value="2" />
</appSettings>
</configuration>target.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="test20180421" value="1" />
<add key="test20180423" value="3" />
<add key="test20180422" value="2" />
</appSettings>
</configuration>I got the patch.xml as following
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0" xdt:Transform="RemoveAttributes(xmlns)" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="test20180423" value="3" xdt:Transform="InsertBefore(/configuration/appSettings/add[(@key='test20180422')])" />
</appSettings>
</configuration>when I try to apply the source, I got the exception
Microsoft.Web.XmlTransform.XmlNodeException: No element in the source document matches '/configuration/appSettings/add[(@key='test20180422')]' ---> Microsoft.Web.XmlTransform.XmlTransformationException: No element in the source document matches '/configuration/appSettings/add[(@key='test20180422')]'
at Microsoft.Web.XmlTransform.InsertBase.get_SiblingElement()
at Microsoft.Web.XmlTransform.InsertBefore.Apply()
at Microsoft.Web.XmlTransform.Transform.ApplyOnce()
at Microsoft.Web.XmlTransform.Transform.Execute(XmlElementContext context, String argumentString)
--- End of inner exception stack trace ---
at Microsoft.Web.XmlTransform.XmlTransformationLogger.LogErrorFromException(Exception ex)
at Microsoft.Web.XmlTransform.XmlTransformation.Apply(XmlDocument xmlTarget)
at FatAntelope.CommandLine.Program.Main(String[] args) in E:\GitHub\Other\FatAntelope\FatAntelope.CommandLine\Program.cs:line 104
Microsoft.Web.XmlTransform.XmlTransformationException: No element in the source document matches '/configuration/appSettings/add[(@key='test20180422')]'
at Microsoft.Web.XmlTransform.InsertBase.get_SiblingElement()
at Microsoft.Web.XmlTransform.InsertBefore.Apply()
at Microsoft.Web.XmlTransform.Transform.ApplyOnce()
at Microsoft.Web.XmlTransform.Transform.Execute(XmlElementContext context, String argumentString)