Processing instructions for style tweaks?

Daniel W. Connolly ([email protected])
Tue, 29 Nov 1994 17:38:19 -0600


There's a lot of talk about new elements, attributes, entities, and
even new data formats to control style and presentation of HTML
documents.

HTML+ is a proposed set of extensions to HTML to add presentational
control, among other things.

DSSSL-Lite[1] is an idea to scale down the DSSSL spec for use on the
web etc.

The NetScape browser supports a few new elements and attributes for
presentation.

There are a couple different "scopes" of presentation/style features:

I. The need to provide a distinct, consistent look across of set of web
documents. A publisher/information provider wants you to know when
you're visiting one of their pages, and they want you to like it.

For this, stylesheets are the logical mechanism: you don't clutter up
each document with the style info, since that just wastes bandwidth
and presents a maintenance nightmare. In stead, you abstract the common
presentation into something like a DSSSL-Lite stylesheet.

II. The need to make individual documents "look right." I see lots
of noise like:

<ul>
<p> <!-- provide a little space before the first item -->
<li> xlkjdlfkj
</ul>

<dl>
<dt> <h3>Slug</h3> <!-- get the right font -->
<dd> explanation
</dl>

It's a shame that folks compromise the structural integrity of their
documents to convince Mosaic to display documents the way they'd like.
It discourages folks from, for example, developing tools to build a
table of contents out of the <Hn> tags in HTML documents, since those
tags are used for font changes, rather than to mark headers.

But presentation _is_ important.

And even when (not if) some sort of stylesheet mechanism gets deployed,
do you think somebody's going to:

* give an element an ID and construct a stylesheet that gives
the element with that Id a little more space, and maintain
the association between the document and the stylesheet
or
* add a <p> tag before the element

Yup. Thought so.

So what if we gave folks an option that's as simple as adding a <p>
tag, but doesn't affect the structure of their document at all?

What if we support little bits of DSSSL inside processing instructions,
ala:

<ul>
<? (space-before: 12pt) >
<li> xlkjdlfkj
<li> ablkjasdf
</ul>

<dl>
<? (font-weight: 'bold font-size: 14pt)> <!-- get the right font -->
<dt>Slug
<dd> explanation
</dl>

This has the following features:

* It's simple to maintain
* It's independent of the DTD. You could use it in HTML, HTML+,
DocBook, etc.
* The semantics can be defined in terms of DSSSL, a (draft)
international standard with zillions of person-years of
work behind it
(if a different stylesheet mechanism gets deployed, the same
sort of thing should work. But DSSSL-Lite seems as good
as any right now.)
* It doesn't affect the structure of the document

When you get to the point that there are so many processing
instructions in there that it ceases to be "simple to maintain," you
have the option of creating a suitable stylesheet.

The only tricky thing is to decide what the scope of a given
processing instruction is. I propose that processing instructions go
right before start tags, and their scope of influence is the element
that the tag starts. In other words,

<? (characteristic: value ...)> <tag> ...

has the same effect as

<tag id=xxx123> ...

with a declaration like this added to the stylesheet:

(id xxx123
(sequence
characteristic: value
...
(process-children)
))

Well, there might be some kinks to work out, but you get the idea.

Does this seem like a good idea?

[1] http://www.falch.no/~pepper/DSSSL-Lite/