Open chucklu opened 6 years ago
It seems like a bug in Microsoft.Web.XmlTransform, I will look into it. the log info I got from Microsoft.Web.XmlTransform
Executing RemoveAttributes (transform line 1, 76) on /_defaultNamespace:configuration Applying to 'configuration' element (source line 2, 2) patch20180523104824805.config (1, 76) warning: Argument 'xmlns' did not match any attributes base.xml (2, 2) warning: No attributes found to remove Done executing RemoveAttributes
I have found bug in AttributeTransform class of Microsoft.Web.Xdt
private XmlNodeList GetAttributesFrom(XmlNode node, IList<string> arguments, bool warnIfEmpty) {
string[] array = new string[arguments.Count];
arguments.CopyTo(array, 0);
string xpath = String.Concat("@", String.Join("|@", array));
XmlNodeList attributes = node.SelectNodes(xpath);
if (attributes.Count == 0 && warnIfEmpty) {
Debug.Assert(arguments.Count == 1, "Should only call warnIfEmpty==true with one argument");
if (arguments.Count == 1) {
Log.LogWarning(SR.XMLTRANSFORMATION_TransformArgumentFoundNoAttributes, arguments[0]);
}
}
return attributes;
}
XmlNodeList attributes = node.SelectNodes(xpath); The SelectNodes did not consider the node could have xmlnamespace.
I have base.xml and target.xml, and I want to apply the target to base. 1.base.xml
2.target.xml
3.patch file
4.nothing happened when I apply the patch to the source.