Flow Objects
The basic building block of DSSSL style sheets are called flow objects. Flow objects are presentational objects that end up in the output document. These flow objects can be things like paragraphs, pages, sequences of characters, or elements and attributes.
Each flow object has a display characteristic that determines whether it is displayed (starts on a new line) or is inlined (runs into the container of previous element). In addition, depending on what they are, flow objects have other characteristics such as page margins, font sizes, heights, and widths.
Flow objects are international in nature so that a single style sheet can be used to format documents in natural languages with different writing directions. It is because of this that things like indentations are always given as start and end values rather than as left or right values to reflect the fact that not everyone writes from left to right.
Not all the DSSSL flow object classes are supported by jade. The following ones are:
- • scroll-A scroll flow object class is used as the top-level flow object for an online display that doesn't divide the output into pages (such as an HTML document). It accepts displayed flow objects. The viewing environment determines the size of the flow object in the direction perpendicular (sideways) to the filling direction (downwards).
- • paragraph-A paragraph flow object class represents a paragraph. Its contents may be either inlined or displayed. Inline flow objects are formatted to produce line areas. Displayed flow objects implicitly specify a line break, and their areas are added to the resulting sequence of areas. The paragraph flow object class is the basic flow object for formatting blocks of text.
- • paragraph-break-Used with the paragraph-break flow object class, a paragraph flow object class can represent a sequence of paragraphs. The paragraphs are separated by paragraph-break flow objects, which are atomic. Paragraph-break flow objects are allowed only in paragraph flow objects. All the characteristics that apply to a paragraph flow object are also applicable to a paragraph-break flow object. The characteristics of a paragraph-break flow object determine the formatting for the portion of the content of the paragraph flow object following that paragraph-break flow object up to the next paragraph-break flow object, if any.
- • character-A character flow object class is formatted to produce a single inline area (character flow objects may only be inlined). The area can be merged with adjacent inline areas. You'd use a character flow object to give a string of characters a different layout or different characteristics from the paragraph in which it is located.
- • line-field-The line-field flow object class is inlined and has inline content. It produces a single inline area. The width of this area is equal to the value of the field-width characteristic. If the content of the line-field area can't fit in this width, the area grows to accommodate the content. If the line-field occurs in the paragraph, there's a break after the line-field. You can use these objects to create fixed-width prefixes for items in a list, so that the start of the first character after the prefix doesn't depend on the size of the prefix. This flow object class is useful for things like prefix text in front of indented paragraphs.
- • external-graphic-The external-graphic flow object class is used for graphics in an external entity (graphics imported by reference). Flow objects of this class may be inlined or displayed.
- • horizontal-rule and vertical-rule-These rule flow object classes specify horizontal rules and vertical rules; they may be inlined or displayed.
- • score-The score flow object class is used for underlining and ruling through (scoring) characters.
- • embedded-text-The embedded-text flow object class is used for embedding right-to-left text within left-to-right text, or vice-versa. This flow object can only be inlined.
- • box-The box flow object class is used to put a box around a sequence of flow objects; this flow object can be either displayed or inlined. If the box is displayed, it accepts any displayed flow objects. If it's inlined, it accepts any inline flow objects.
A box flow object may result in more than one area, in which case the border of the box adjacent to the break may be omitted. If the box is inlined, this border is perpendicular to the writing-mode, but if it's displayed, this border is parallel to the writing-mode.
When the box is displayed, the size of the box (the distance between the positions of the borders) in the direction determined by the writing-mode is equal to the box's display size, less the start and end indents. The display size for the box's content is equal to the size of the box. - • table-A table flow object class contains either all of table-part or all of table-column, table-row, or table-cell flow objects. If it contains table-column flow objects, they must appear before all the other flow objects. A table flow object can only be displayed. A table has two directions associated with it: a row-progression direction and a column-progression direction.
- • table-part-A table-part flow object class is allowed only within a table flow object. A table-part flow object consists of a table body, a table header, and a table footer. Only table-column flow objects are allowed in a table body. A table-row and a table-cell may be used anywhere in a table-part.
The result of formatting a table-part flow object is a sequence of areas. Each area consists of the header's content (unless explicitly omitted), followed by some portion of the table body's content, followed by the table footer's content (unless explicitly omitted). Each row in the table body occurs exactly once, and the order of the rows is kept. The rows in the table header and footer are replicated for each result area (this allows the header to be repeated when a table is divided over more than one page). - • table-column-A table-column flow object class is an atomic flow object that specifies characteristics applicable to table cells that have the same column and span.
- • table-row-A table-row flow object class groups table cells into rows; all table cells in a table-row start in the same geometric row. A table-row accepts table-cell flow objects. A table-row flow object can occur only as the child of a table-part or table flow object.
- • table-cell-A table-cell flow object class accepts any flow object that can be displayed. A table-cell flow object may occur only as the child of a table-row, table-part, or table flow object. The table's width is equal to the sum of the cells' widths.
- • table-border-A table-border flow object class is used to specify the border of a table cell or an entire table. However, a table-border flow object is not allowed in the content of any flow object. The width of borders doesn't affect the width of the cells, the positioning of the contents of the cells, the table's width, or the size of the area produced by the table.
- • sequence-A sequence flow object class is formatted to concatenate the areas produced by each of its children, which can be either inlined or displayed. A sequence flow object is useful for specifying inherited characteristics. Another flow object accepts a sequence flow object only if it would accept each of the flow objects inside that sequence.
- • display-group-A display-group flow object class concatenates other flow objects in the same way as sequence flow objects, but it also creates a new display area by starting on a new line and is followed by a new line (even if it has no content). These flow groups are used for controlling the positioning of groups of displayed flow objects.
- • simple-page-sequence-A simple-page-sequence flow object class is formatted to produce a sequence of page areas. This flow object accepts any displayed flow object, but it isn't allowed within the content of any other flow object. You'd use this flow object for the root element of a document, or for any element that you want to start at the top of a new page.
A simple-page-sequence flow object may have a single line header and footer containing text that's constant, except for a page number. A document can contain multiple simple-page-sequences. For example, each chapter of a document could be a separate simple-page-sequence, which would allow the chapter title to be used in a header or footer line.
The page is filled from top to bottom. The display size for the contents of the simple-page-sequence is the page width, less the left and right margins. - • link-A link flow object class represents a hypertext link that can be interactively traversed, typically by clicking on the areas representing the flow object and its content. However, as you have seen, in XML you don't necessarily have to click on a link to traverse it. A link can contain both inlined and displayed flow objects. Link flow objects can be nested. If they are nested, the innermost link is effective.
DSSSL is easy enough that it's possible to make basic style sheets for simple XML DTDs just by learning the names of a few of these flow objects. All you have to do then is list their mappings in the style sheet to print through construction rules.