Heretical view

Subject: Heretical view
From: "Oren Ben-Kiki" <oren@xxxxxxxxxxxxx>
Date: Fri, 12 Feb 1999 13:30:34 +0200
As an application developer, I started pretty neutral wrt. FO vs. CSS
rendering. Given today's market I'm generating HTML+CSS but I could with
very little work switch to FOs or to anything else - all it would take me is
rewriting my XSL stylesheets.

Or so I thought. But it recently hit me that things aren't that simple.
There are some very basic differences between the CSS view and FO view of
rendering. I'm not referring to things like "how to I left align text this
week", but to questions of dynamic behavior.

CSS is based on the notion of attaching styling information to an XML tree
without transformation. This allows me to dynamically change the style,
again without transformations. Since the same style can be associated with
several separate XML elements, one can easily cause wide-ranging dynamic
styling effects by modifying a small number of style sheets.

Using FOs, it seems as though I'd need to re-transform the effected portions
of the XML document. If I'm not certain where they are, I'd have to
re-transform it all. This is a common occurrence - think for example of a
button which causes all links in the text to be highlighted. I haven't found
anything in the FO specs which would allow me to say "all these elements
have the exact same background color" - and let me access this color in a
single place in the DOM later on.

Even for static documents, it helps to have the style information in a
single place and specify it as a set of overriding defaults. Yes, you can do
that using XSL templates, but the cascading effect isn't easy to achieve,
and anyway the assumption that the output of XSL goes directly to
rendering - that it is never manipulated again - isn't something I'm
comfortable with.

I find it unfortunate that CSS isn't using XML syntax. But having static
rendering information is worse. If forced to choose, I'd choose CSS -
regardless of any other technical advantages FOs might have. As they stand,
FOs seem to me as an alternative to TeXml - that is, they have an advantage
for printed documents - and frankly, I'd rather use XSL to transform into
TeXml directly.

So, my current (heretical) view is:

- Dump FOs. Instead define an XML-ized syntax for CSS. Since CSS can be
manipulated by the DOM, this means just back-translating the DOM interface
into equivalent XML constructs. Should be just a few days of work. It would
also be trivial for browsers to implement an additional XML-ized syntax for
inputting styles and stylesheets.

- Most of the CSS bad press as a rendering format can be traced back to
lousy implementation. CSS2 is supposed to be better. The real issues left
should be fixed. CSS3? Anyway, if the effort which was supposed to go to
implementing FOs would go to improving CSS, I'm certain we'd get something
reasonable.

- XSL, relieved of the FO part, would handle the transformational part of
rendering. For those people who want to see HTML dead, don't worry - since
you can attach CSS to any XML, then most of HTML's tags would be redefined
as <SPAN> with a default CSS stylesheet. Also people would be generating
their own XML languages with CSS attachments. A browser would become a
generic XML rendering client and HTML would become a not-that-important
special case.

- Dynamic behavior would be added as JavaScript code manipulating the DOM,
just like today.

I wouldn't bring up this heretical view (even in this day and age, I might
get burned :-), but what I see is that the above is happening already -
minus XML-izing CSS, which is a real pity. This is happening not just
because CSS is here and FOs aren't; as I said, CSS has real technical
advantages when it comes to dynamic applications. Instead of fighting it,
XSL could join it - and fix the syntax problem as a blessed side effect.
Browser implementers would be so relived they don't need to implement FOs
they'll implement the new CSS syntax without any protest.

I guess now is a good time to hide somewhere for a while :-)

"If you can't beat them, join them"

    Oren Ben-Kiki


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread