Changing namespace on copy
Hi all!
What's the most effective way of changing the namespace of a node when copying it? Here's a simple example:
<ns1:root xmlns:ns1="http://www.someUrl.com/ns1">
<ns1:element>element to be imported</ns1:element>
</ns1:root>
<abc:result xmlns:abc="http://www.myUrl.org/elements">
<abc:element>element to be imported</abc:element>
</abc:result>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns1="http://www.someUrl.com/ns1" xmlns:abc="http://www.myUrl.org/elements" exclude-result-prefixes="ns1">
<xsl:template match="/">
<abc:result>
<xsl:copy-of select="//ns1:element[1]"/>
</abc:result>
</xsl:template>
</xsl:stylesheet>
This example is quite simple, but in my case, the element to be copied is several levels deep, all of it's descendants are in the same source namespace and have to be converted to the result namespace.
Thanks,
Rushman
Dijkstra's law on Programming and Inertia:
If you don't know what your program is supposed to do, don't try to write it.
__________________
Dijkstra's law on Programming and Inertia:
If you don't know what your program is supposed to do, don't try to write it.
|