[xsl] xmlns=""

Subject: [xsl] xmlns=""
From: Gustaf Liljegren <gustaf.liljegren@xxxxxx>
Date: Tue, 11 Mar 2003 17:44:11 +0100
It seems I have still things to understand about namespaces. I made a
stylesheet to convert an in-house XML format to XHTML 1.1. For some reason,
I get a xmlns="" on each top-level element beneath <body>. If I remove the
default namespace declaration in the <html> root element, they disappear. 

Here's an abbreviated excerpt of the output:

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

<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="sv">
   <head>
      <title>...</title>
      <link rel="stylesheet" type="text/css" href="style.css"/>
   </head>
   <body>
      <h1 xmlns="">...</h1>
      <p xmlns="">...</p>
      <h2 xmlns="">...</h2>
      <p xmlns="">...</p>
      <table xmlns="">
         ...
      </table>
      <ul xmlns="">
         <li>...</li>
         <li>...</li>
         <li>...</li>
      </ul>
   </body>
</html>

And here's the template for the root element:

  <!-- Root node template -->
  <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="sv">
      <head>
        <title><xsl:value-of select="heading1"/></title>
        <link rel="stylesheet" type="text/css" href="style.css"/>
      </head>
      <body>
        <xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>

My XSLT processor is Saxon 6.5.2.

Gustaf



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread