You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Erik Bruchez <er...@bruchez.org> on 2001/10/07 11:41:53 UTC

HTML serializer and XHTML namespace

Hi all,

I've been trying to get the HTML serializer to work correctly when
explicitely specifying the XHTML namespace in my documents. This is
what I have in my sitemap:

    <map:match pattern="test.xml">
      <map:generate src="test/test.xml"/>
      <map:transform src="test/test.xsl"/>
      <map:serialize type="html"/>
    </map:match>

This is test.xml:

   <?xml version="1.0" encoding="ISO-8859-1"?>

   <test:document xmlns:test="http://bruchez.org/test">
     <test:entry>
       This is my paragraph.
     </test:entry>
   </test:document>

This is test.xsl:

   <?xml version="1.0" encoding="ISO-8859-1"?>

   <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:xhtml="http://www.w3.org/1999/xhtml"
     xmlns:test="http://bruchez.org/test"
     exclude-result-prefixes="#default xhtml test">

     <xsl:template match="/">
       <xsl:apply-templates select="test:document"/>
     </xsl:template>

     <xsl:template match="test:document">
       <html>
	<body>
	  <p>
	    <xsl:value-of select="test:entry"/>
	  </p>
	  <br/>
	</body>
       </html>
     </xsl:template>

   </xsl:stylesheet>

This produces the following output, with which I'm pretty happy:

   <html>
   <body>
   <p>
   This is my paragraph.
     </p>
   <br>
   </body>
   </html>

I then changed test.xsl as follows (the only addition is
xmlns="..."):

   <?xml version="1.0" encoding="ISO-8859-1"?>

   <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:xhtml="http://www.w3.org/1999/xhtml"
     xmlns:test="http://bruchez.org/test"
     xmlns="http://www.w3.org/1999/xhtml"
     exclude-result-prefixes="#default xhtml test">

     <xsl:template match="/">
       <xsl:apply-templates select="test:document"/>
     </xsl:template>

     <xsl:template match="test:document">
       <html>
	<body>
	  <p>
	    <xsl:value-of select="test:entry"/>
	  </p>
	  <br/>
	</body>
       </html>
     </xsl:template>

   </xsl:stylesheet>

The output is now:

   <html xmlns="http://www.w3.org/1999/xhtml">
   <body>
   <p>
   This is my paragraph.
     </p>
   <br/>
   </body>
   </html>

It looks like the HTML serializer didn't work as I expected. My
questions are:

o is this a legitimate use of the XHTML namespace
o if so, is the observed behavior a bug?

Thanks,

-Erik


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>