NOTES ON THE SAMPLE DSSSL HTML STYLESHEET ========================================= Mirrored from: ftp://sunsite.unc.edu:/pub/sun-info/standards/dsssl/stylesheets/html3_2/README (Last updated 1996.08.03) The file(s) named html32hc.dsl in this directory contain a DSSSL stylesheet for making hardcopy printouts from documents conforming to the HTML 3.2 DTD. Use of the stylesheet requires a DSSSL engine that isn't publicly available yet. The idea is that you can feed a conformant HTML 3.2 document, the HTML 3.2 DTD, and the stylesheet to a DSSSL engine and get out something like RTF, MIF, or TeX that can be taken into an application that knows how to print it. While designed specifically for print output, the same stylesheet can be adapted to driving electronic publishing tools such as Web browsers when DSSSL-capable versions of those tools become available. Current versions of this stylesheet are lacking support for the more complex table extensions in HTML 3.2, though they will produce tables that can very easily be autoformatted in a program like Word to yield pleasing and useful results. On the other hand, the stylesheet supports features missing from HTML 3.2 such as headers, footers, optional autonumbering of heads and table captions, and the correct and completely extensible interpretation of named units in size and length attributes. In designing the stylesheet, I've tried to make use of the fact that DSSSL is a real programming language by defining functions that make the stylesheet more compact and using variables that make it easier to customize. I've tried (I hope consistently) to use the following conventions: Names in ALLCAPS are common functions defined for use throughout the stylesheet. Names surrounded with $dollar-signs$ are "construction macros" (so to speak) that define a construction rule applicable to more than one element type. Names surrounded with *asterisks* are constant parameters designed to be changed by the user in order to modify the overall look of the formatted document. The default behavior of the stylesheet as supplied is to produce printed pages that have a header in italics, set flush left in the default body font-family in a size one point less than the size of the default body type and containing the content of the document's element, and a footer of the same size set flush right and containing the generated string "Page " followed by the page number. Heads H1-H6 are in Arial (the stylesheet was designed for Windows 95, but of course the font families can easily be changed like everything else); H1-H3 in the default configuration hang out into a 6-pica-wide area to the left of the text flow, while H4-H6 are set flush left with the text flow. All the heads are autonumbered, and table captions are both autonumbered and preceded with the generated string "Table ". The body type is Times, set justified. For convenience, three predefined font size treatments are provided: "normal" for the usual case, "presbyopic" for us old folks, and "large-type" for people with impaired vision. The default stylesheet produces pages that look something like ordinary book pages, but the treatment can be altered radically by changing a few of the parameters. For example, a treatment suitable for code documentation containing many programming examples could be created as follows: 1. Change the text quadding (set in the construction rule for the HTML element) from justified to flush left (i.e., "start" in the writing direction of a left-to-right script): ;; quadding: 'justify quadding: 'start 2. Get rid of the text indent in order to use the full width of the text area: ;; (define *body-start-indent* 6pi) (define *body-start-indent* 0pi) 3. Hardwire the monospace font size to 9pt: ;; (define *mf-size* *bf-size*) (define *mf-size* 9pt) Besides providing what I hope will be a useful adjunct to a DSSSL engine for HTML users, the stylesheet should help to clarify the differences between the DSSSL and CSS approaches to formatting specifications. In particular, this example demonstrates the following: 1. A DSSSL stylesheet will typically be more complex than a CSS stylesheet. This is partly because of the syntax, but much more importantly because the DSSSL stylesheet sets up the entire formatting environment, while a CSS stylesheet is just specifying adjustments to the stylesheet presumed to be implicit in a target application. In the CSS approach, if you don't supply a stylesheet, you still get a stylesheet. In the DSSSL approach, you only get what you have specified. 2. CSS is a way to specify formatting characteristics. DSSSL is an actual (side-effect free) programming language, ISO/IEC 10179:1996. 3. CSS is designed as an adjunct to HTML and will not scale to handle arbitrarily complex structures. DSSSL is designed to specify formatting for any language defined in conformance with ISO 8879, including the vastly more complex markup languages used in industrial and commercial publishing. An interesting consequence is that people using this stylesheet to format HTML documents can extend HTML itself by adding tags and attributes at will. As long as the HTML DTD is adjusted accordingly, the resulting language will be conformant with ISO 8879 and usable not only with any DSSSL engine but also with all currently available SGML publishing tools. 4. The example only uses features of DSSSL's style language. DSSSL also includes a transformation language for performing structural modifications. For example, the transformation language can be used to "reformat" a telephone directory ordered by last name into a directory ordered by first name, or to generate a book's index or table of contents, or to convert documents marked up in one tag language to documents marked up in another. Comments on this example and questions relating to DSSSL and SGML should be posted to the comp.text.sgml newsgroup. Jon --- Jon Bosak, Online Information Technology Architect Sun Microsystems, 2550 Garcia Ave., MPK17-101, Mountain View, CA 94043 Davenport Group::SGML Open::ANSI X3V1::ISO/IEC JTC1/SC18/WG8::W3C SGML ERB