[whatwg] <base> versus xml:base

Geoffrey Sneddon wrote:
 > XHTML 1.0/1.1 doesn't allow xml:base, though, so <base> is the only > 
 > way to set a base URL within the document.

In what way would the XHTML 1.0/1.1 spec **disallow** the use of this 
element from the xml namespace? It's not *part of* the spec, but that's 
a different matter, right?

I've been told is that xml:base should work just fine in Firefox, Opera 
and other XHTML-capable browsers, when content is served as 
application/xhtml+xml.

OTOH, for this message I decided to do a little test. The following will 
be served as true XHTML by my server:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <title>Testing xml:base</title>
     <style type="">
         div#msg {
             background: pink;
             padding: 2em;
             text-align: center;
             font-size: xx-large;
         }
     </style>
     <xml:base href="http://dev.keryx.pad/xhtml/css/" />
        <!-- link to my test server -->
     <link href="style.css" rel="stylesheet" type="text/css" />
   </head>
   <body>
     <div id="msg">Pink background if &lt;xml:base&gt;
         is not supported, otherwise light green</div>
   </body>
</html>

In the external CSS I have:
div#msg {
     background: lightgreen !important;
}
div#msg:after {
         content: " - <xml:base> works! External CSS recognized.";
}

When I try this in Firefox 2.0 it does not work, nor will it in Opera 9.10.

It may be that I've implemented this in the wrong way - corrections are 
welcome - but it seems to me that even though <xml:base> is legal today, 
it is **not** supported by UAs. Which makes Anne's proposal, that <base> 
should be allowed in both serializations, even more important.


Lars Gunther

Received on Monday, 5 March 2007 13:07:03 UTC