15

web.config に次のノードがあります。

<configuration>
...
<scheduling>
 <agent>
  <param desc="database">core</param>
 </agent>
 <agent>
  <param desc="database">master</param>
 </agent>
</scheduling>
...
</configuration>

<agent>マスター コンテンツを持つ子パラメーター ノードを持つノード全体を削除したい。多かれ少なかれ、私の xdt 変換ノードは次のようになります。

<configuration>
...
<scheduling>
  <agent
         xdt:Transform="Remove"
         xdt:Locator="XPath(./param[@desc='database']/??????)" />
</scheduling>
...
</configuration>

ご覧のとおり、ノードのコンテンツ文字列と一致させる方法がわかりません。ここに何を追加する必要がありますか?

環境メモ: Windows 7 - Visual Studio 2010 SP1

4

1 に答える 1

14

text()ロケーターに追加のテストを追加します。<param>ノードを一致させるには:

xdt:Locator="XPath(./param[@desc='database' and text()='master'])">

編集: ノードを一致させるには、XPath が一致する述語<agent>に移動する必要があります。param

xdt:Locator="Condition(param/@desc='database' and param/text()='master')">
于 2012-03-14T17:51:09.743 に答える