Re: [XBL] Namespace prefixes in Selectors

On Tue, 12 Sep 2006, Simon Pieters wrote:
> 
> In XBL namespace prefixes in Selectors are declared with the 
> xmlns:foo="" notation[1]:
> 
> > In XBL attributes that take selectors, the namespace prefixes that may 
> > be used are the prefixes that are in scope using the xmlns:* syntax.
> 
> I feel uncomfortable about this. The XML namespace prefix is just 
> syntactic sugar to bind a namespace name to an element or an attribute. 
> The application might not even know about the prefixes, if it is using 
> another model than the DOM.

It has to use the DOM if it is implementing XBL, since XBL is a DOM-based 
language.


> Also, XML documents might be namespace prefix rewritten, which shouldn't 
> change the semantics of the document.

So long as the prefixes in the selectors are changed too, there's no 
problem. In practice, rewriting the prefixes of an XBL document would be a 
very bad idea since it would indeed cause the kind of confusion you point 
out. It would also cause problems with the attribute forwarding attribute, 
and with a number of features in other languages (like XHTML2).


> If we instead had the namespace declarations for Selectors in some 
> attribute value or in content, then they would survive namespace prefix 
> rewritings

The cost, however, namely of having to declare many prefixes twice, would 
IMHO be too high.


> and apps that don't know about XML prefixes are able to implement XBL.

You need to know about XML prefixes to implement XBL. It's just one of 
those things you need to know, like Unicode, XML, the DOM, etc.


> On the other hand, I realize that it might be more convenient for 
> authors to just use the xmlns:* syntax, and perhaps apps already know 
> about prefixes, and namespace rewriting perhaps isn't an issue, but I 
> think this deserves some discussion.

Does the above discussion satisfy your request for discussion? :-)


> Now, if we ignore the above for a bit and look at how it's currently 
> defined, I have a separate question: does the implied "xml" namespace 
> prefix apply to Selectors?

I've now explicitly mentioned that the "xml" prefix is always declared.


> As in:
> 
>   <xbl xmlns="http://www.w3.org/ns/xbl">
>    <binding element="*[xml|base]">...
> 
> ...or does it have to be declared explicitly? How does *[xmlns|foo] 
> work? (The "xmlns" prefix has a namespace, but it can't be declared 
> explicitly.)

xmlns is also now defined to be always declared. (Technically both of 
these facts -- that xml and xmlns are always declared -- are already 
stated in [XMLNS], but it makes no harm to say it again in the XBL spec.)

How exactly, and indeed whether, "*[xmlns|foo]" works is not clear, but it 
works the same as it would in CSS if you declared that prefix, so I'm not 
going to say anything special here.


> Namespace prefixes in Selectors in CSS are case insensitive. All 
> attribute values are case-sensitive in XBL. Perhaps it would be good to 
> add a note in [1] that explains why this is different between CSS and 
> XBL.

Woops. This is actually a problem. Selectors are case-insensitive and 
XMLNS prefixes are case-sensitive, so I need to declare how you map from 
one to the other.

I've tried writing some text for this.


Please let me know if this e-mail and the changes made along with it don't 
satisfy your comments.

You can see the editor's draft here:

   http://dev.w3.org/cvsweb/~checkout~/2006/xbl2/Overview.html?content-type=text/html

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 5 October 2006 22:16:55 UTC