xquery を使用して親ノードから子ノードを削除しようとしています。たとえば、xml に以下に示すエントリがあるとします。
<entry>
<id>36</id>
<title>Engineering Village Author Tool</title>
<updated>2009-09-30T12:55:42Z</updated>
<libx:libapp>
<libx:entry xmlns:libx="http://libx.org/xml/libx2" src="37"/>
</libx:libapp>
</entry>
子ノードを削除するにはどうすればよいですか
<libx:entry xmlns:libx="http://libx.org/xml/libx2" src="37"/>
次の xquery コードを使用しています。
declare namespace libx='http://libx.org/xml/libx2';
declare namespace atom='http://www.w3.org/2005/Atom';
declare variable $child_id as xs:string external;
declare variable $parent_id as xs:string external;
declare variable $doc_name as xs:string external;
declare variable $feed as xs:anyAtomicType := doc($doc_name)/atom:feed;
let $parent_entry := $feed/atom:entry[atom:id=$parent_id]
return delete node $parent_entry//libx:entry[@libx:src=$child_id]
ここで渡される変数の値は次のとおりです。 child_id = 37 parent_id = 36 doc_name = 使用されているドキュメントの名前
名前空間の使用方法または行の xquery で使用している xpath 式のいずれかに何か問題があると推測しています。
return delete node $parent_entry//libx:entry[@libx:src=$child_id]
これを修正するのを手伝ってください。