[xsl] Copy one namespace, replace another

Subject: [xsl] Copy one namespace, replace another
From: "Marc Franquesa" <marc.franquesa@xxxxxxxxx>
Date: Mon, 7 Aug 2006 15:23:38 +0200
Hi, I'm trying to do something that probably is very easy, but I don't
get what I won't.

The source XML document is an XHTML page with the correct namespace,
and using default namespace (no prefix). In the source document there
are very few elements (three) in another namespace (my own
http://www.l3jane.net/doxpace/l3Build/) prefixed with l3b.

I 'm trying to develop a XSLT stylesheet that copies "as-is" the xhtml
elements and transform the
other (l3b namespace) elements. The result document _must_be_  XHTML or HTML.

I see this trickl to handle namespaces in XSLT (but I'm not sure that
works well):
http://www.forum4designers.com/message145552.html

So I write this a very simple stylesheet: with this rules:

<xsl:template match="xhtml:*" >
	<xsl:copy-of select="." />
</xsl:template>

<xsl:template match="l3b:moduleName" >
	<xsl:value-of select="$ModuleName" />
</xsl:template>

I belive that the problem is that the 'match="/"', copy the entire
tree without checking the namespace of the inner elements. But I don't
know how to make this in easy manner with few templates.

I tried using <xsl:apply-templates /> instead of copy-of, but then the
result document only has the PCDATA nodes, not the xhtml elements
structure.

I hope that I explain well what I'm trying to do.

Thanks for any hint!

--
"If you don't know where you're going,
any road will take you there" - Lewis Carroll
Visit http://www.l3jane.net/
Marc Franquesa
Vic - Catalonia
--------------------------------------------------------------

Current Thread