私の要件は、Relation のwhereまたはor onlyのいずれか@guidと一致する Relation タグを削除することです。上記のロジックは、関係のwhereまたはor onlyのいずれかと一致する必要がある場合にも適用できます。@relationObj<roleCode tc=32><roleCode tc=31><roleCode tc=8>@relationObj@relationObj<roleCode tc=32><roleCode tc=31><roleCode tc=8>
基本的に、またはまたはに属する他の関係タグを検索@guidして検索したい。この条件が true の場合、このセクションを削除します。@relationObj@relationObj<roleCode tc=32><roleCode tc=31><roleCode tc=8>
以下は XML です。
<Relations>
<Relation guid="abcd1234" relationObj="1234">
<roleCode tc="20"/>
</Relation>
<Relation guid="xyz123" relationObj="1111">
<roleCode tc="32"/>
</Relation>
<Relation guid="def123" relationObj="2222">
<roleCode tc="31"/>
</Relation>
<Relation guid="1111" relationObj="2222">
<roleCode tc="98"/>
</Relation>
<Relation guid="jkl123" relationObj="3333">
<roleCode tc="8"/>
</Relation>
<Relation guid="2222" relationObj="1234">
<roleCode tc="100"/>
</Relation>
</Relations>
テンプレート内@relationObjでそれぞれ抽出する変数を 3 つ作成してみました。<roleCode tc>[32,31 and 8]そして、これら 3 つの変数と比較@objectIdします。しかし、ここでの問題は、反復中に別のタグ@relationObjに遭遇すると、変数が空の値に更新されることです。<Relation>
上記のxmlから、変換後にxmlの下に取得する必要があります。
<Relations>
<Relation guid="abcd1234" relationObj="1234">
<roleCode tc="20"/>
</Relation>
<Relation guid="xyz123" relationObj="1111">
<roleCode tc="32"/>
</Relation>
<Relation guid="def123" relationObj="2222">
<roleCode tc="31"/>
</Relation>
<Relation guid="jkl123" relationObj="3333">
<roleCode tc="8"/>
</Relation>
<Relation guid="2222" relationObj="1234">
<roleCode tc="100"/>
</Relation>
</Relations>
観察すると、<Relation>[guid="1111" relationshipObj="2222"] のタグが削除されています。@guid と @relationObj の両方が roleCodes - 32、31、または 8 のいずれかに属しているためです。
新しい変数で更新せずに変数に値を保存するのに最適なものを教えてください。または、これを達成できるより良いアプローチがありますか。御時間ありがとうございます。