Re: [xsl] Unwanted default namespace copied to output in XSLT v1.0

Subject: Re: [xsl] Unwanted default namespace copied to output in XSLT v1.0
From: Ian STOKES-REES <ijstokes@xxxxxxxxxxxx>
Date: Fri, 30 Nov 2007 08:55:43 -0500
David Carlisle wrote:
Any suggestions how to avoid this problem?


in xslt 1 xsl:copy always copie in scope namespaces so if you don't want
that, don't use xsl:copy, instead use

<xsl:element name="{name()}" namespace="{namespace-uri()}">

which generates a new element with same name as the old one, but without
copying namespace nodes.

In fact, that was what I was doing before, however I was missing the namespace="..." attribute and the result was the stylesheet only worked when I had all the input document namespaces declared in the stylesheet, which was not possible since the input document namespaces are not known in advance.


Thanks for your help. Works a charm.

Ian

--
Ian Stokes-Rees, Consultant           SP Metric Technology Consulting
ijstokes@xxxxxxxxxxxx                 http://www.spmetric.com

Current Thread