Re: CSS Namespaces: Need multiple namespaces!

On Wed, 29 Sep 1999, L. David Baron wrote:

>> In the CSS3 namespace draft, a namespace prefix can be associated
>> with only a single namespace at a time.
> I did actually already mention this problem [1].

Oops. I must have missed that when I did my www-style catch-up (I lost
two weeks' worth of mail around that time due to quota problems...).


> I did so at a time when XHTML only used one namespace, though.
> Multiple namespaces for the same vocabulary bug me...

I agree; but as devil's advocate I suppose one could argue that they
are not the same vocabulary. One may be a subset of another, but they
are not actually the same. For example, one allows <font> inside <p>,
whereas another does not. 

When|If Schemas are pointed to by namespace URIs (as suggested in
various packaging ideas recently), then namespaces will fill basically
the same role as PUBLIC/SYSTEM FPIs/DTDs, and so n (where here n=3)
namespaces will become a necessity.


>> I suggest that the @namespace syntax be extended to allow an
>> arbitrary number of url()s. Comments?
> As I mentioned in [1], this causes some problems with the attr()
> pseudo-function.

Aha. It would appear, however, that you have already suggested a
solution (namely, using the first matching attribute) and this
solution would seem to be fine.

If one wanted a particular attribute, then one could explicity qualify
it. For example, with this document:

   <!DOCTYPE x>
   <x xmlns:n="NewsML" xmlns:g="GuideML" xmlns:h="HTML4-s">
      <y title="Well" n:title="Hello" g:title="Exciting" h:title="World"> </y>
   </x>

...and this CSS:

   @namespace texts url(HTML4-s) url(NewsML) url(GuideML);
   @namespace html4s url(HTML4-s);
   * { tooltip: attr(title); } /* uses "Well" */
   * { tooltip: attr(html4s|title); } /* uses "World" */
   * { tooltip: attr(texts|title); } /* uses "Hello" because its the first match */

...you can see that attr(unqualified) gives the element's attribute,
attr(nslist:attr) gives the first matching attribute from those
namespaces given by "nslist", and attr(ns:attr) gives the attribute
which matches the one namespace.

As for default values, see section 5.8.2 of CSS2:

# 5.8.2 Default attribute values in DTDs
#
# Matching takes place on attribute values in the document tree. For
# document languages other than HTML, default attribute values may be
# defined in a DTD or elsewhere. Style sheets should be designed so
# that they work even if the default values are not included in the
# document tree.

Since both David and I have independently suggested this, it _must_ be
a good idea... ;-)

-- 
Ian Hickson
: Is your JavaScript ready for Nav5 and IE5?
: Get the latest JavaScript client sniffer at 
: http://developer.netscape.com/docs/examples/javascript/browser_type.html

Received on Wednesday, 29 September 1999 10:31:46 UTC