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

Specifying the XHTML XMLNS

Subject: Specifying the XHTML XMLNS
From: knocte <knocte@xxxxxxxxx>
Date: Wed, 28 Sep 2005 14:59:39 +0200
xhtml xmlns
Hello.

I am having the "xhtml xmlns" issue that has already been discussed in
this list. If I specify it using xsl:attribute I finally get the xmlns
attribute specified in many nodes instead of only in the <html> one.

I have read many messages from that thread but I don't get to finally
understand all the "namespace stuff"... I will give you my specific
style-sheet so as to see if anyone could point me about the specific
change I should do for finally getting
xmlns="http://www.w3.org/1999/xhtml" only in the <html> tag:

XML:

<?xml version="1.0" encoding="utf-8"?>
<page>
  <title>My specific title</title>
  <head>
    <link rel="stylesheet" href="./css/login.css" type="text/css" />
    <script type="text/javascript" src="./js/login.js"></script>
  </head>
  <content>
    <h2>Test</h2>
  </content>
</page>


XSLT:

<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
<xsl:stylesheet version="1.0"
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>Main app title - <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>


Result:

<html xml:lang="es">
  <head>
    <title>Main app title - 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"></link>
    <script type="text/javascript" src="./js/login.js"></script>
  </head>
  <body>
    <div id="divHeader">This is my header</div>
    <div id="divContent"><h2>Test</h2></div>
    <div id="divHeader">This is my footer</div>
  </body>
</html>


Thanks very much,

    Andrew  [  knocte  ]

--

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.