Re: Stylesheet Language

Steve Heaney ([email protected])
Tue, 26 Oct 1993 18:55:51 +0100


All,

Could I suggest that rather that re-invent the wheel, we consider using an
SGML DTD for specifying stylesheets.

Below is Pei Wei's example reimplemented using an *existing* SGML DTD that was
designed as a page description language.

<outspec>
<docdesc>
<charlist>
<font size="12pt" bckcol="white" fontcol="black">
</charlist>
</docdesc>

<e-i-c gi="h1"><font size="24pt" bckcol="red", fontcol="white">
</e-i-c>

<e-i-c gi="h2"><font size="20pt" bckcol="red", fgcol="white">
</e-i-c>

<e-i-c gi="a"><font fgcol="red">
</e-i-c>

<e-i-c gi="cmd kbd screen listing example"><font style="monoser">
</e-i-c>

<e-i-c gi="bold emph strong"><font weight="bold">
</e-i-c>

<e-i-c gi="i"><font posture="italic">
</e-i-c>

<e-i-c gi="p" context="address"><font posture="italic">
</e-i-c>

<e-i-c gi="li" context="ol"><counter style="romanlc">
</e-i-c>

<e-i-c gi="li" context="ol li ol"><counter style="alphalc">
</e-i-c>

<e-i-c gi="footnote"><font size="10pt">
</e-i-c>

</outspec>

(The e-i-c tag is element in context - I hope the rest are reasonably
self evident).

This compares to the example below in Pei Wei's original posting.

(HEAD,BODY fontSize=normal
BGColor=white
FGColor=black
(H1 fontSize=largest
BGColor=red
FGColor=white)
(H2 fontSize=large)
(P)
(A FGColor=red)
(CMD,KBD,SCREEN,LISTING,EXAMPLE fontFamily=fixed)
(BOLD,EMPH,STRONG fontWeight=bold)
(I fontSlant=italic)
(ADDRESS
(P fontSlant=italic))
(OL
(LI numStyle=roman
(LI numStyle=number
(LI numStyle=alpha)
)
)
)
(FOOTNOTE fontSize=small
(P)
)
)

There are several advantages to this - and several disadvantages.

On the plus side:

1. It is SGML and so it can be validated with the tools some of us already
use.
2. Once we have a public domain SGML editor, we can use that to write
our stylesheet.
3. It is a standard already. The Formatting Output Specification Instance
DTD is used as the page description language as part of the US Dod CALS
initiative.
4. It is supported by several commercial SGML editors.
5. Given that it is a standard, implementations of tools supporting it
may/will appear in the public domain.
6. As the requirements made of stylesheets expand (as they undoubtedly
will) there is the framework already there to guide development. (The
FOSI DTD has many features not demonstrated in the example above).
7. Why reinvent the wheel?

On the minus side:

1. it is probably less easy to read.
2. it is therefore less easy to write without assistance.

How about it?

As something to mull over - *not* as a request to add these to the
specification for style sheet as currently conceived, here are some of the
other formatting attributes that the FOSI DTD includes:

<presp> amount of space to render before element. | not currently handled
<postsp> amount of space to render after element. | consistently by browsers
<indent> left/right indent.
<boxing> place box around element (I think Marc mentioned this).
<textbrk> whether to break text at start/end of element, create new page etc.
<quadding> left/right/center.

And some more exotic options:

<savetext> save copy of text.
<usetext> place saved text in output stream.
<enumerat> control the behaviour of element counters i.e. section numbers,
list numbering etc.

Steve.

------------------------------------------------------------------------
Steven Heaney

Schlumberger Geco-Prakla
Internet: [email protected]
------------------------------------------------------------------------