Hi Paul,
I believe that adding the following line to the element construction should
work:
$node/namespace::*,
Kind regards,
Geert
>
Drs. G.P.H. Josten
Consultant
http://www.daidalos.nl/
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit
bericht kunnen geen rechten worden ontleend.
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Paul M
> Sent: dinsdag 15 september 2009 21:36
> To: [email protected]
> Subject: [MarkLogic Dev General] element construct with recursion
>
> 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