Headlines with complex numberings

Headlines with generated numberings in several levels can be typographically designed in a satisfying way with the help of tables.

This example shows analogously to headlines with simple numberings how complexly numbered headlines can be designed with the help of table structures. Here, the table structure is the same as in the section "Headlines with simple numberings". Therefore, no comments are provided.

Excerpt from the DTD:

<!ELEMENT Part (Title, Article+)>
<!ELEMENT Article (Title, ..., Section*)>                ❶
<!ELEMENT Section (Title, ..., Section*)>                ❶
<!ELEMENT Title (#PCDATA | ...)*>

❶ The first level contains the parts, the second level contains the articles. The sections in the articles represent the (optional) third level. The sections are recursively valid. In the following stylesheet the level <Part> shall not be numbered. The level <Article> shall be consecutively numbered (no matter in which part the articles appear). The levels below (<Section>) are numbered up to the third sub-level. So, the numbering has a maximum format of "1.1.1.1".

Stylesheet:

<xsl:template match="Part/Article/Section/Title">                                ❶
   <fo:block xsl:use-attribute-sets="Headline-Title2" 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="any" count="Part/Article" format="1."/>  ❷
                     <xsl:number level="multiple" count="Article/Section |       ❸
                        Article/Section/Section | Article/Section/
                        Section/Section" format="1.1"/> 
                  </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 the section headlines in the first section level.

❷ The first <xsl:number> element specifies the numbering of the articles. For the generation the level attribute with the value any determines the consecutively numbering across component boundaries, the count attribute determines what shall be numbered (article) and the format attribute determines how the numbering shall look like (Arabic numerals followed by a dot).

❸ The second <xsl:number> element specifies the numbering of the sections. For the generation, the level attribute with the value multiple determines that the counting shall again start with one if the level above changes, the count attribute determines what shall be numbered (sections up to the third sub-level) and the format attribute determines how the numbering shall look like (Arabic numerals followed by a dot, the last number without a dot). Please note that in this example all levels to be numbered have to be listed in the count attribute in an "or-ed" form.

 

<< 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, hallo@dpunkt.de