Re: CSS Namespaces: Need multiple namespaces!

On Wed, 29 Sep 1999, Peter Linss wrote:
> The real issue here is how namespaces are really going to be used in
> the real world. My takeaway from reading the Namespace Rec is that a
> namespace is *just a name*, the URL doesn't actually point to
> anything and shouldn't be overloaded to point to a schema or DTD or
> anything (except perhaps someday some information about the
> *namespace* not the document where it is used).

Well, this is very much an open issue, but the Schema WG do seem to be
considering using the namespace URI to point to Schemas and whatnot:

   http://www.w3.org/TR/xmlschema-1/composition-tf.html

However, this has no effect on CSS as far as I can tell.

 
> If [the XHTML WG] set a stake in the ground and say "namespaces
> don't have versions or flavors", then having this feature in CSS may
> only lead to more confusion in the namespace arena. Which is
> something I'd like to avoid.

This feature is _not_ only for the case where we have versioned/
flavored namespaces. A much more important reason for CSS to have this
feature is for styling the elements with the same name in several
namespaces. For example, you could have a stylesheet which styled
documents that might have snippets in several other namespaces. If
these namespaces had a common vocabulary subset, then you could do
this:

   @namespace text url(xhtml) url(GuideML) url(ReviewML);

   text|p { margin: 1em 0; } /* paragraphs in all our various text
   markup languages should have 1em margins between them. */

The alternative (and only way with the current draft) is:

   @namespace xhtml url(...xhtml);      
   @namespace guideml url(...GuideML);  
   @namespace reviewml url(...ReviewML);

   xhtml|p, guideml|p, reviewml|p { margin: 1em 0; } /* paragraphs in
   all our various text markup languages should have 1em margins
   between them. */

Now, doing that with a simple type selector this doesn't cause many
problems. But when you have this kind of situation:

   @namespace metadata url(mdspec1) url(mdspec2) url(mdspec3);
   @namespace text url(xhtml) url(GuideML) url(ReviewML);

   text|p[metadata|status~=draft] { background: url(draft.png); }

...expanding that results in six namespace prefixes and nine
selectors! The stylesheet becomes quickly unreadable for a large
number of rules.

Also, adding a new namespace later means editing just one line if
@namespace can take more than one namespace, but a zillion lines if
you have to add a prefix and update every relevant rule.

-- 
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 17:46:35 UTC