Subject:Copy element without namespace Author:Suriya Simsuwat Date:11 Jan 2008 02:59 AM
Hi again,
I have one more question to inquiry from you guys that if I want to want to use XSLT copying from xml containing namespace to a new xml without namespace. How can I do it. I have written XSLT for this routine, but it still did not work as what I want yet, so can anyone give me some suggestion to work through it. Thank you in advance.
Subject:Copy element without namespace Author:(Deleted User) Date:11 Jan 2008 09:41 AM
You are not building an output "without namespace", you are writing it in the same namespace of the input.
You should add a xmlns="...." declaration to your XSLT stylesheet, so that gapi ends up in the correct namespace.
Subject:Copy element without namespace Author:James Durning Date:14 Jan 2008 03:09 PM
For reference for anyone searching this forum:
In your stylesheet node add the following: exclude-result-prefixes="t"
Change your recursive template to use apply-templates instead of copy-of, except for attributes which you still copy.
Declare elements dynamically, using <xsl:element> and local-name() function encased in braces.
Code: ( xml )
<xsl:element name="{local-name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>