[XML-SIG] Stripping a namespace

Thomas B. Passin tpassin@comcast.net
Wed, 19 Jun 2002 17:00:05 -0400


[Douglas Bates>

> Anyway, when I copy the description element into another document and
> PrettyPrint the target document, I end up with all the markup that
> appears in the source document as
>  <i>S</i>
> showing up in the target document as
>  <i xmlns='http://purl.org/dc/elements/1.1/'>S</i>
>
> I want the abstract in the target document to appear like the abstract
> in the source document.
>

I think you have already gotten all the pieces of this.  The elements you
want to copy in the target document are in the dc namespace.  When you copy
them, the processor has to keep the namespace (since the elements are in it
already), thus the declaration that you started out asking about.

The solution has been suggested to: instead of just copying the nodes,
create new ones in no namespace, then copy the attributes and PCDATA that
you want.

Alternatively, you could do it with an xslt stylesheet.   You could pull out
what you want and output it without a namespace prefix.  You could do that
with Python, for example by using 4slt.

Cheers,

Tom P