Re: [xsl] xmlns="" / XML to XHTML

Subject: Re: [xsl] xmlns="" / XML to XHTML
From: Alexander Nichau <ml@xxxxxxxxxx>
Date: Tue, 13 Sep 2005 11:58:13 +0200
Joris Gillis schrieb:
<xsl:template name="content_xhtml">
<xsl:param name="content" select="/page/content/topic"/>
<xsl:apply-templates select="$content/text/*" mode="put_in_new_namespace">
<xsl:with-param name="new_namespace"></xsl:with-param>

<xsl:template match="*" mode="put_in_new_namespace" priority="1">
<xsl:param name="new_namespace"/>
<xsl:element name="{local-name()}" namespace="{$new_namespace}">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates select="node()" mode="put_in_new_namespace">
        <xsl:with-param name="new_namespace" select="$new_namespace"/>

<xsl:template match="node()" mode="put_in_new_namespace">
    <xsl:copy-of select="."/>

With the help of Joris Gillis we tried to modify my examples. The above code from Joris gives the following output:

 <ns1:h2 xmlns:ns1="";>...
            <ns2:p xmlns:ns2="";>...
            <ns3:p xmlns:ns3="";>...
et cetera

So I think, his code does create the right elements but instead of
putting the namespace to XHTML according to the rest of the output (I
mean put an empty prefix there) the processor numerates each namespace.

So how can I skip the namespace numeration to get browser legible XHTML?
(The browser doesnB4t interpret nsXX as XHTMl though it has the right XML
Namespace - Strange. Why they call it "extensible html" while it isnB4t
really extensible? (Or at least browsers donB4t get it)

Michael, you meant I should skip this example and modify my second example (based on pawsonB4s FAQ)?:

<xsl:template match="*">
   <xsl:element name="{local-name()}"
 namespace=""; >
    <xsl:apply-templates />

So the problem there was, that my inner elements didnB4t get the ns
although the outer elements were created correct in the xhtml namespace.
So I ask why does it not apply the namespace to the inner elements or
what should I modify?

Thanks in advance, Alexander

Current Thread