W3C home > Mailing lists > Public > www-style@w3.org > September 2006

Re: [css3-namespace] Scope of Namespace with @import

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Tue, 05 Sep 2006 17:01:59 +1000
Message-ID: <44FD20E7.4090205@lachy.id.au>
To: karl@w3.org
CC: www-style@w3.org

karl@w3.org wrote:
> Then let's take this example.
> 
> <html xmlns="http://www.w3.org/2002/06/xhtml2/"
>       xmlns:dc="http://dublincore.org/documents/dcmi-namespace/"
>       xml:lang="en">
>    <head>
>      <title>Some Document</title>
> 	 <style type="text/css">
> 	    @import url(foo.css);
> 	    @namespace dc "http://dublincore.org/documents/dcmi-namespace/";
> 	    dc|title {text-align: center;}
> 		dc\:title {text-align: right;}
> 	  </style>
>    </head>
>    <body>
>      <dc:title><cite href="urn:isbn:0060006994">Fix-it Duck</cite></dc:title>
>    </body>
>  </html>
> 
> with foo.css containing
> 
> 	@namespace dc "http://dublincore.org/documents/dcmi-namespace/";
> 	dc|title {text-align: left;}
> 
> Which rules apply? From the specification as it is defined, it is not sure.

Selectors defines that dc\:title will only match in downlevel clients 
that don't support namespaces in CSS [1].  In such clients, due to the 
cascading rules, this rule would take precedence.  In newer clients, 
this rule won't match anything.

Since both the embedded and the imported style sheets declare the 
namespace, the other two will both match the dc:title element.  Normal 
cascading rules will apply and, I believe, text-align: center; will take 
precedence.

[1] http://www.w3.org/TR/css3-selectors/#downlevel

-- 
Lachlan Hunt
http://lachy.id.au/
Received on Tuesday, 5 September 2006 07:04:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:46 GMT