问题描述
我正在尝试创建转换,该转换将根据此 回答 没有成功
这样:
<配置><运行时><assemblyBinding
将转换为:
<运行时><assemblyBinding这是我到目前为止:
您可以在线使用此转换模拟器
解决方案 最需要注意的是,要删除的元素继承了默认命名空间 .也就是说,您尝试的 XPath 不会匹配任何内容,因为它没有考虑命名空间.
您可以忽略命名空间(不可取),或者创建一个指向默认命名空间的前缀并在您的 XPath 中使用该前缀,例如:
我更喜欢按照链接答案中的建议使用 Condition
:
I'm trying to create transform that will remove a node by it child node based on this answer without success
so that:
<?
will be transformed to:
<configuration>
<runtime>
<assemblyBinding
this is what I've so far:
<configuration
you can use this online transform simulator
解决方案 The most important thing to note is that the element that you want to remove inherits default namespace . That said, your attempted XPath will not match anything since it didn't account for the namespace.
You can either ignore the namespace (inadvisable), or create a prefix that point to the default namespace and use that prefix in your XPath, for example:
<configuration
I prefer using Condition
as suggested in the linked answer:
<configuration
这篇关于xdt 通过子节点属性转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!