Re: [xsl] Copy idiom and overriding namespaces: trying to be smart, finding approaches

Subject: Re: [xsl] Copy idiom and overriding namespaces: trying to be smart, finding approaches
From: Abel Braaksma Online <abel.online@xxxxxxxxx>
Date: Wed, 26 Jul 2006 22:09:41 +0200
Hi George,

Thanks for looking into it and remembering. I looked through the thread, and what I understand from it, is that it's basically the same approach I am using. Meaning, that I should feel confident with the current solution as being the right one to use. A copy of my last attempt, leaving out comment nodes and processing instructions:

<xsl:template match="@*" >
<xsl:copy /> </xsl:template>
<xsl:template match="*" >
<xsl:element name="{local-name()}" namespace="{$target-namespace}">
<xsl:apply-templates select="@* | node()" />
</xsl:element>
</xsl:template>


In short, I could conclude that it is not possible to make a template only for namespace nodes and change the result tree namespace when you encounter an input namespace. Use for-each can be used for getting all namespace nodes. Using the above, can be used to create elements that are ripped off of any namespace information, and receive a new namespace instead. Looking again at the above, it doesn't look that hard anymore now... ;)

Cheers,
Abel

George Cristian Bina wrote:

Hi Abel,

Have a look at the following thread from a couple of weeks ago
http://www.biglist.com/lists/xsl-list/archives/200607/msg00133.html
There you can see a stylesheet that changes namespaces and element and attribute names.


Best regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Current Thread