Re: CSS and SGML document formatting
Gavin Nicol writes:
> >| CSS is small, it's easy. Anybody can work with, or design something
> >| like it. The one thing is is *not* is suitable as a general-purpose
> >| stylesheet language for large scale publishing of structured
> >| documents.
> >Part of the problem in trying to explain the limitations of CSS for
> >generic SGML formatting is the lack of real-world examples. I am
> >working (slowly) on a set of typical cases drawn from actual online
> >publications to show the kind of functionality that has to be in a
> >stylesheet language that can handle the ordinary run of commercial
> 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?
Ah, a puzzle!
1. The literal answer is probably not the answer the author is looking
2. `foo' and `bar' are commonly used as placeholders for arbitrary
3. The only clue is thus the dot (.)
4. A dot in CSS can occur in two contexts: to seperate an element and
a class, or as a decimal point.
5. Since `foo' and `bar' are seldom used to stand for numbers, let's
assume `foo' is an element and `bar' is a class.
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...
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.
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.
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.
One remaining problem: neither answer is very `profound'...
Bert Bos ( W 3 C ) http://www.w3.org/
email@example.com 2004 Rt des Lucioles / BP 93
+33 93 65 77 71 06902 Sophia Antipolis Cedex, France