【问题标题】:Move XML element using XDT使用 XDT 移动 XML 元素
【发布时间】:2014-11-21 14:47:56
【问题描述】:

有没有办法使用 XDT 在另一个元素中移动一个 XML 元素,包括它的所有内容?

例如,我想转换以下 XML:

<?xml version="1.0"?>
<a>
    <b someAttribute="someValue">someContent</b>
</a>

进入这个:

<?xml version="1.0"?>
<a>
    <c>
        <b someAttribute="someValue">someContent</b>
    </c>
</a>

通过将b 元素移动到新创建的c 元素内。我希望像下面这样的东西会起作用:

<?xml version="1.0"?>
<a xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <c xdt:Transform="Insert">
        <b xdt:Locator="XPath(/a/b)" xdt:Transform="an appropriate transform" />
    </c>
</a>

但是 AFAIK 没有可以做到这一点的转换。

【问题讨论】:

    标签: xml xdt-transform xdt


    【解决方案1】:

    正如Web.config transforms - surrounding elements 中所回答的那样,目前不支持此功能,但此问题确实提供了一种解决方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-17
      • 2021-10-04
      • 2013-05-27
      • 1970-01-01
      • 2013-04-17
      相关资源
      最近更新 更多