[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xmlns="" / XML to XHTML

Subject: Re: xmlns="" / XML to XHTML
From: Alexander Nichau <ml@xxxxxxxxxx>
Date: Tue, 13 Sep 2005 11:58:13 +0200
empty prefix xmlns
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">http://www.w3.org/1999/xhtml</xsl:with-param>
</xsl:apply-templates>
</xsl:template>


<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:apply-templates>
</xsl:element>
</xsl:template>

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

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="http://www.w3.org/1999/xhtml">...
</ns1:h2>
            <ns2:p xmlns:ns2="http://www.w3.org/1999/xhtml">...
              <ns2:br></ns2:br>
...
</ns2:p>
            <ns3:p xmlns:ns3="http://www.w3.org/1999/xhtml">...
              <ns3:br></ns3:br>
...
</ns3:p>
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="http://www.w3.org/1999/xhtml" >
    <xsl:apply-templates />
   </xsl:element>
</xsl:template>

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.