[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Specifying the XHTML XMLNS


Subject: Re: [xsl] Specifying the XHTML XMLNS
From: knocte <knocte@xxxxxxxxx>
Date: Wed, 28 Sep 2005 16:34:35 +0200

> But presumably this was not generated by the stylesheet that you posted
> earlier, as that had a literal result element <link> so if you added
> xmlns="http.... to xsl:stylesheet then this link element would be in the
> xhtml namespace not in no-namespace and you woul dnot get xmlns=""
> generated.

Of course not. I have posted the "original" stylesheet that didn't
include the xmlns declaration. If I make the change you suggest, the
XSLT becomes (the same but with an extra xmlns declaration in
xsl:stylesheet tag):

<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="xml" indent="no"
              doctype-public="-//W3C//DTD XHTML 1.1//EN"
              doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
              encoding="ISO-8859-15" />

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="/page">
    <html>
      <xsl:attribute name="xml:lang">es</xsl:attribute>

      <head>
        <title>DHL - <xsl:value-of select="title" /></title>
        <meta name="author" content="knocte" />

        <script type="text/javascript" src="./js/general/amuse.js"></script>
        <script type="text/javascript"
src="./js/general/general.js"></script>
        <link rel="stylesheet" href="./css/general/site.css" type="text/css"
/>

        <xsl:apply-templates select="head/*" />

      </head>

      <body>

        <div id="divHeader">This is my header</div>

        <div id="divContent">
          <xsl:apply-templates select="content/*" />
        </div>

        <div id="divHeader">This is my footer</div>

      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>


And the resultant XML is:

<html xml:lang="es" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>DHL - My specific title</title>
    <meta name="author" content="knocte" />
    <script type="text/javascript" src="./js/general/amuse.js"></script>
    <script type="text/javascript" src="./js/general/general.js"></script>
    <link rel="stylesheet" href="./css/general/site.css" type="text/css" />
    <link rel="stylesheet" href="./css/login.css" type="text/css"
xmlns=""></link>
    <script type="text/javascript" src="./js/login.js" xmlns=""></script>
  </head>
  <body>
    <div id="divHeader">This is my header</div>

    <div id="divContent">
      <h2 xmlns="">Test</h2>
    </div>

    <div id="divHeader">This is my footer</div>
  </body>
</html>


How can I avoid the no-namespace ('xmlns=""') declaration?

  Thanks again,

    Andrew    [ knocte ]

--


Current Thread
Keywords