Re: [xsl] how to remove xmlns attributes in html out put via copy-of

Subject: Re: [xsl] how to remove xmlns attributes in html out put via copy-of
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Fri, 10 Dec 2004 16:13:06 +0100
Hi Jan,

Copy-of will copy namespaces as well, you will have to get rid of them explicitely. Try:

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

<xsl:template match="entry:Para">
  <p>
    <xsl:apply-templates select="node()" />
  </p>
</xsl:template>

Cheers,
Geert

Jan Limpens wrote:

hi,

in my xml I have xhtml markup such as this:

<Document xmlns="http://limpens.com/entry";>
<Para>The solution came in the form of <a
href="http://authors.aspalliance.com/PaulWilson/Articles/?id=14";>Wilson's
Master pages</a>.</Para>
</Document>

my xslt tries to convert this to valid xml
	<xsl:template match="entry:Para">
		<p>
			<xsl:copy-of select="node()" />
		</p>
	</xsl:template>

but produces xmlns attributes in the xhtml tags, such as...
<p>The solution came in the form of <a
href="http://authors.aspalliance.com/PaulWilson/Articles/?id=14";
xmlns="http://limpens.com/entry";>Wilson's Master pages</a>.</p>

wheather this is correct behaviour or not, I don't like the added
namespace in the anchor element too much, because it breaks my
otherwise valid xhtml.

I am using the .net (version 1.0) processor.
I tried to look it up in the archives and the faq, but didn't find
anything useful (whereas I am quite positive my question has already
been answered numeous times), so I hope nobody minds.

Thanks in advance!

-- Geert.Josten@xxxxxxxxxxx IT-consultant at Daidalos BV, Zoetermeer (NL)

http://www.daidalos.nl/
tel:+31-(0)79-3316961
fax:+31-(0)79-3316464

GPG: 1024D/12DEBB50

Current Thread