define function remove-elements-deep
( $nodes as node()* ,
$names as xs:string* ) as node()* {
for $node in $nodes
return
if ($node instance of element())
then if (fn:name($node)=$names)
then ()
else element { fn:node-name($node)}
{ $node/@*,
remove-elements-deep($node/node(), $names)}
else if ($node instance of document-node())
then remove-elements-deep($node/node(), $names)
else $node
}
let $in-xml-2 :=
<in-xml xmlns="dns" xmlns:x="http://x">
<x:a>
<b>b1</b>
<c>c1</c>
</x:a>
<x:c>Mixed <bb>content</bb></x:c>
</in-xml>
return
remove-elements-deep(
$in-xml-2,
'c')
(:
<in-xml xmlns="dns"><a xmlns="http://x"><b xmlns="dns">b1</b></a><c
xmlns="http://x">Mixed <bb xmlns="dns">content</bb></c></in-xml>
The above expands prefixes to actually uri namespaces, and adds inherited
parent namespaces. I assume during element construction this occurs? Is there
any method around this? I understand it is equivalent xml, but it is a bit
more verbose.
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general