ID selectors problem?

Hello,

I am new here, so please excuse me, if this problem has been already discussed - I would appreciate than a navigation to the place, where it was discussed / published. Thank you.

So:

The definition (quoting http://www.w3.org/TR/html4/types.html#h-6.2) says:
"
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
"

Also the definition of attribute of id type in XML says (quoting http://www.w3.org/TR/REC-xml/#sec-attribute-types and http://www.w3.org/TR/REC-xml/#NT-Name):
"
Values of type ID MUST match the Name production.
...
NameChar	   ::=   	Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
Name	   ::=   	(Letter | '_' | ':') (NameChar)*
"

Now an imaginatory example:

Let's say, I have letters (mails) published in electronical form. Each letter is presented as single HTML, XHTML or XML file, where the root element (or "body" in (X)HTML) has id derived from its URL - http://letters.com/first-letter would produce the "letters.com:first-letter" id, which is correct according to specification above.

Now, when I put it in CSS, it does not work:
My expectation: #letters.com:first-letter will work for <any_element id="letters.com:first-letter" />
Real life: (depends on UA support of first-letter pseudo-element) works for first letter of <any_element id="letters" class="com" />
Anyway: how should UA recognize, if it is:
<any_element id="letters.com:first-letter" />
first letter of <any_element id="letters.com" />
<any_element id="letters" class="com:first-letter" />
first letter of <any_element id="letters" class="com" />
?
Is there any rule about it?

(Yes, there is a way around - [id=letters.com:first-letter] , but it does not do the same even if !important being added, because the #id notation is attribute-name-independent.)

Of course, anybody can say this is pretty wild example (yes, but it was just for demonstration), but however, if there is a need to have ids like this, what is the solution?

My idea:
Same as eg. font names must be in quotation marks if contains a whitespace (font-family: "Arial Narrow",  sans-serif;) should quotation marks work here as well:
#"letters.com:first-letter" for <any_element id="letters.com:first-letter" />
#"letters.com":first-letter" for first letter of <any_element id="letters.com" />
#letters."com:first-letter" for <any_element id="letters" class="com:first-letter" />
#letters.com:first-letter for first letter of <any_element id="letters" class="com" />

I've tried to read a bunch of W3C recommendations, but didn't find an answer. Again, if it was already published somewhere, please excuse me, and navigate me there. Thank you.

Thanks for any info about this!

Danny

Received on Saturday, 8 October 2005 04:43:13 UTC