Re: CSS and SGML document formatting -Reply

Scott E. Preece writes:
 > 	<STYLE>
 > 		<RULE elements=BODY>
 > 			<PROPERTY> margin=1em
 > 			<PROPERTY> font-family=serif
 > 			...
 > 		</RULE>
 > 		<RULE elements="H1,H2,H3,H4">
 > 			<PROPERTY>margin-top=1em
 > 			<PROPERTY>margin-bottom=1em
 > 		</RULE>
 > 		...
 > 		<RULE elements="IMG" context="A:link">
 > 			<PROPERTY> border-color=red
 > 	...		
 > Or even create separate elements under RULE for each property, as in
 > your example.
 > I don't know the answer.  Naming and character restrictions might have
 > been an issue. The extra bulk of the SGML notation might have been an
 > issue.  Maybe the authors would like to comment.

There are several reasons. In no particular order:

   1. To use elements like in your example would have required
      changing the HTML DTD. You know how difficult that is. And it
      would have had to be done every time CSS changed. Now we only
      need a <STYLE> once. Modularity!

   2. Talking about parsing: is there anything more diffcult to parse
      than SGML? We take care that our language is accompanied by a
      lex/yacc spec. (Actually, it is not yacc currently, because I'm
      using an LL(1) parser generator, but the conversion is

   3. Readability is much better if the language is specifically
      designed for its purpose. All those quotes and angle brackets
      don't help much. (You could use shortrefs, but they are frowned
      upon by most people, and they don't make parsing any easier.

   4. CSS is more compact, which is nice both for the user (up to a
      point, of course) and for the network.

The choice may have been different for products like Softquad's
Panorama or EBT's DynaText, since they already contained a more generic
SGML parser which they could reuse. They also knew they would have a
style editor to hide the syntax from the user. And when their style
languages were designed they didn't use a network.

You can ask the same question of DSSSL: why did it use a Lisp-like
syntax instead of SGML?

  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/pub/WWW/People/Bos/                      INRIA/W3C
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 93 65 77 71                 06902 Sophia Antipolis Cedex, France

Follow-Ups: References: