Re: CSS and SGML document formatting

I wrote:
> I can provide an even simpler, though more profound reason, and I will
> present it as a koan.
>
>   What does foo.bar mean in CSS?
 
To which you replied:
 
>1. The literal answer is probably not the answer the author is
>looking for.
 
  Correct

>2. `foo' and `bar' are commonly used as placeholders for arbitrary
>character strings. 

  Correct
 
>3. The only clue is thus the dot (.)

  Correct
 
>4. A dot in CSS can occur in two contexts: to seperate an element and 
>a class, or as a decimal point.

  Correct
 
>5. Since `foo' and `bar' are seldom used to stand for numbers, let's
>assume `foo' is an element and `bar' is a class.

  Incorrect
 
>6. There is a syntactical ambiguity in foo.bar, that has been solved
>in a way that computer scientists may not like: by relying on the
>presence of white space (foo.bar <> foo .bar). But computer science is
>not `profound', so let's move on...

  This is fine, though as you note, inelegant.
 
>7. In the context of generic SGML, there is nothing special about an
>element (unless whether it is in RCS or not, see below), so assume the
>problem is with the class.

  This is correct, though founded on a faulty assumption(5).
 
>Answer 1: The class attribute is only present in HTML, not in `generic
>SGML', but many other DTD's have in fact a similar attribute. The
>dot-notation is therefore a shorthand for `foo [class=bar]' (to borrow
>an earlier CSS syntax proposal). Of course, one can add a declaration
>at the top of a CSS file that from now on `.' is a shorthand for
>`type' instead of `class', as has actually been described in an
>earlier version of CSS. This is another case where generality has been
>dropped (momentarily?) in order to speed CSS acceptance.

  Fine. Shortcuts are not necessarily a bad thing.
 
>Answer 2: Assuming it is the reliance on the Reference Concrete Syntax
>that is the hidden meaning behind foo.bar, this, too, has been
>addressed in the CSS spec. It is actually possible to use *any* syntax
>(by using escapes), but only RCS will look nice.

  I saw no reference to this in CSS1. Can you please explain it, or
  point to the section containing it's specification. I assume that
  this is the "\\\." tacked onto the end of the nmchar rule in the lex 
  specification? 
 
>One remaining problem: neither answer is very `profound'...

  True, but I don't think you have correctly solved the puzzle
  either. 

In the reference concrete syntax, a period is legal in a name. So
something like

  <!ELEMENT foo.bar - - (#PCDATA)>
  <!ATTLIST foo.bar
            class  CDATA #IMPLIED
            foo    CDATA #IMPLIED
            bar    CDATA #IMPLIED>

is perfectly legal. I suppose that the lexical (but I could not find
actual text describing this) specification allows you to write 

    foo\.bar.foo

or
    foo\\\.bar.foo

which the application would have to figure out the meaning of (the
latter would probably be illegal).

This could get very ugly, very quickly for variant concrete syntaxes.
  

Actually, the one part of CSS that I dislike very much is the selector
mechanism.

Received on Friday, 26 April 1996 12:54:21 UTC