Re: [css3-namespace] what is a "no namespace"

Anne van Kesteren wrote:
> 
> On Tue, 19 Feb 2008 19:57:53 +0100, Christof Hoeke <csad7@t-online.de> 
> wrote:
>> This is more or less the issue which the XML Namespace specification 
>> would prevent. Defining a namespace with the empty string as 
>> namespaceURI is not allowed in XML...
> 
> It is in XML 1.1. And there's talk of backporting that to 1.0. Anyway, 
> what makes you think this is an issue?

I did not know about XML 1.1 had changed that (XML 1.1 which I guess 
should be seen as a failure as the current discussion on XML-dev about 
XML 2.0 shows).

Anyway, it would/will be an issue if XML and CSS handle namespaces 
differently and regarding XML 1.0 and current CSS they do:

 XML:
  <example xmlns:empty=""/>
  => invalid
 CSS:
  @namespace empty "";
  => valid


>>>  No. By default type selectors match elements in every namespace.
>>
>> Is that really how it works? If browsers would match elements in 
>> "every namespace" browsers would not handle namespaces as defined by 
>> the spec? (or am I too confused this evening?)
> 
> Seems like you are.

just to be sure:

given XML:

<doc xmlns="http://example.com#n1"
      xmlns:n2="http://example.com#n2">
 <example/>
 <example xmlns="http://example.com#n3"/>
 <n2:example xmlns="http://example.com#n1"/>
</doc>

CSS selector with no default or any other namespace defined:

 example

would not select anything in the above XML, or does it?
(I wrote another post with a more complete example yesterday in a new 
thread)


>> I somehow assumed as you write later that Browsers somehow use 
>> something like
>>
>>     @namespace "http://www.w3.org/1999/xhtml"
>>
>> for XHTML files. For HTML not using namespaces they use more or less
>>
>>     @namespace ""
>>
>> (in this case the empty string is even allowed in XML but it also 
>> hardly makes any sense at all as there is only the empty namespace 
>> anyway if one could call it that here)
> 
> Not really. Browsers that have "ua.css" file use @namespace 
> "http://www.w3.org/1999/xhtml"; for both HTML and XHTML. But that's 
> besides the point. We're talking about author style sheets here.

(just referring to the question by Richard regarding HTML)

>>>  Note that most browsers, for CSS purposes at least, already act as 
>>> if HTML elements are in the http://www.w3.org/1999/xhtml namespace.
>>
>> (this is what I tried to summarize above)
> 
> You claimed something about @namespace "" ...

you gave the actual implementation above (thanks), above was just what I 
assumed would be how it worked

>>>> I guess I'm looking for information about how this is applied along 
>>>> with the syntactic description.
>>>
>>> Why? It's pretty self-evident. (If the namespaces concept of XML 
>>> namespaces is itself not clear, which seems to be the problem here, I 
>>> suggest simply not bothering with them. Namespaces are hardly 
>>> relevant on the Web anyway.)
>>
>> (I guess they are relevant if you have something like ATOM embedded in 
>> XHTML or are also useful if you like to style a SVG element embedded 
>> in XHTML (very useful when using Prince-XML). But you are of course 
>> right that most websites work just without.)
> 
> Atom in XHTML?! SVG and XHTML work perfectly together without needing 
> the namespace support of CSS.

SVG/XHTML do work, but if you need to style a document using both you 
should
understand namespaces and then they are relevant on the web too I guess.

christof

Received on Wednesday, 20 February 2008 10:10:22 UTC