Headlines with simple numberings
Headlines with generated numberings can be typographically designed in a satisfying way with the help of tables.
This example shall show how headlines can be designed with the help of table structures. In this context the method of the numbering (<xsl:number>) of headlines is explained. In this section only the numbering in one level is shown.
Excerpt from the DTD:
<!ELEMENT Work (Title, Part+)> <!ELEMENT Part (Title, Article+)> ❶ <!ELEMENT Title (#PCDATA | ...)*> ❷
❶<Part> components always have a headline <Title> as first sub-element.
❷ A headline may also contain substructures in addition to simple character data.
<xsl:template match="Work/Part/Title"> ❶ <fo:block xsl:use-attribute-sets="Headline-Title1" hyphenate="false"> ❷ <fo:table width="110mm"> ❸ <fo:table-column column-number="1" column-width="15mm"/> ❸ <fo:table-column column-number="2" column-width="95mm"/> ❸ <fo:table-body> <fo:table-row> ❸ <fo:table-cell column-number="1"> ❹ <fo:block> ❺ <xsl:number level="single" count="Part" format="I."/> ❻ </fo:block> </fo:table-cell> <fo:table-cell column-number="2"> ❹ <fo:block> ❺ <xsl:apply-templates/> ❼ </fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </fo:block> </xsl:template>
❶ The template only refers to <Title> in the <Part> environment.
❷ The headline is embedded in a block. For this block the typographical attributes specified somewhere else in the stylesheet are set as well as attributes which shall only apply for headlines of this level. These attributes are passed on the next substructure of the table.
❸ In this table the two components of the headline shall be arranged in two columns. The column with the number 1 includes the numbering, the column with the number 2 includes the textual content. This column arrangement ensures that the textual content is always struck the same way at the left side if the numbers have different widths and that the numbering is cropped if a break of several lines occurs. No border lines are specified for the table, so it is invisible as a table in the page layout. In this example the table structure shows the simplest form for a table which only consists of one line with two cells. For the vertical alignment of the cell contents display-align="before" is set. This effects that the cell contents are struck at the top cell margin.
❹ By referencing the column number, the corresponding column specifications in <fo:table-column> are adopted. The cell contents are struck at the top cell margin since this corresponds to the default value of the display-align attribute.
❺ The textual content has to be embedded in a block within the table cell, since otherwise the content cannot be aligned horizontally. Without any attribute, the preset start applies for text-align, which means the text is left aligned when using the common writing direction.
❻ In the left table cell the numbering is displayed. For the generation, the level attribute determines the numbering in a level, the count attribute determines what shall be numbered, namely the parts – not the subheadings! –, and the format attribute determines how the numbering shall be displayed. The attribute value I. determines the design pattern: large Roman numerals followed by a dot.
❼ The entire content including any substructures of <Title> in the environment of <Part> is arranged in the right table cell (struck at the top cell margin and aligned to the left).
|<< back||next >>|
Copyright © dpunkt.verlag GmbH 2004
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSL-FO in der Praxis" ("XSL-FO in practice") is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19B, 69115 Heidelberg, fon 06221-14830, fax 06221-148399, firstname.lastname@example.org