W3C home > Mailing lists > Public > www-style@w3.org > October 2003

[CSS21] colons are forbidden in type selectors

From: Elliotte Rusty Harold <elharo@metalab.unc.edu>
Date: Sat, 18 Oct 2003 11:25:06 -0400
Message-Id: <p06002002bbb70a2ea318@[192.168.254.4]>
To: www-style@w3.org

I hope this is already dealt with in some section of the CSS 2.1 spec 
that I haven't read yet, but if not it's a significant issue.

Section 4.1.3 states:

  In CSS 2.1, identifiers  (including element names, classes, and IDs 
in selectors) can contain only the characters [A-Za-z0-9] and ISO 
10646 characters 161 and higher, plus the hyphen (-) and the 
underscore (_); they cannot start with a hyphen or a digit. They can 
also contain escaped characters and any ISO 10646 character as a 
numeric code (see next item). For instance, the identifier "B&W?" may 
be written as "B\&W\?" or "B\26 W\3F".

This rules out the colon character which is widely used in XML names. 
It is not possible given this to write a simple rule such as

pre:name { font-weight: bold}


You could escape the colon; e.g.:

pre\3Aname { font-weight: bold}

I can't find any other workaround in the spec. Ideally we'd want the 
ability to match on namespace URI and local name rather than 
qualified name. However, that will probably have to wait for CSS3. 
In the meantime, it's quite hard to match against colonized names, 
which are frequently used in XML. It's certainly not intuitive. Is 
there any way the colon can be allowed into CSS identifiers?

-- 

   Elliotte Rusty Harold
   elharo@metalab.unc.edu
   Processing XML with Java (Addison-Wesley, 2002)
   http://www.cafeconleche.org/books/xmljava
   http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA
Received on Saturday, 18 October 2003 11:34:26 GMT

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