Multi-column pages with column rules

As an example for multi-column pages, a two-column page with column rules is generated.

In this example a page with two neighbouring columns is generated. These columns are separated by a hyphen. Lines of separation for columns are a proprietary extension of Antenna House, so they are not part of XSL-FO. For the adjustment of the columns at the end in order to get columns with the same height, a block is set at the end which is spanned over both columns.

Source code:

<fo:simple-page-master margin="15mm 20mm 30mm 20mm"
 master-name="Index" page-height="297mm" page-width="210mm">
   <fo:region-body margin="5mm 0mm 7mm 0mm" column-count="2"         ❶
    column-gap="4mm" axf:column-rule-style="solid"
    axf:column-rule-width="1pt"/>
</fo:simple-page-master>
...
<fo:block span="all" color="#FFFFFF" border-after-style="solid"      ❷
 border-after-width="1pt"> 
   <xsl:text/>
</fo:block>
...

❶ The multi-column layout of a page has to be specified in the <fo:region-body> element within the relevant page template (column-count), here on 2. The column-gap attribute defines the gap between the columns. With the two XSL-FO extensions of Antenna House, axf:column-rule-style and axf:column-rule-width, the style and the width of the column rule are determined. Further attributes in this context are axf:column-rule-color (colour of the column rule), axf:column-rule-length (length of the column rule, if it has not the same height as the column) as well as axf:column-rule-align (alignment of the column rule). The namespace axf: has to be specified with the xmlns attribute in the <xsl:stylesheet> element. It goes without saying that other XSL formatters do not support column rules in this form.

❷ In XSL-FO there is no concept for the adjustment of columns. In practise this can be achieved by inserting an invisible block to the desired position in the stylesheet. span is set with the value all. Further attributes ensure that the block does not require additional room and remains invisible.

 

<< back start >>

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