Creating Columns

Another useful way of using XSL-FO to format text is to use columns. Creating columns is not difficult; all you have to do is to use the column-count and column-gapproperties of the <fo:region-body> element and leave the rest up to the XSL-FO processor.

Look at the following example, columns.fo. To format text into two columns with a gap of a quarter of an inch between them, I just set the column-countproperty to “2” and the column-gapproperty to “0.25in”:

 <?xml version="1.0" encoding="utf-8"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master margin-right="20mm" margin-left="20mm" margin-bottom="10mm" margin-top="10mm" page-width="300mm" page-height="400mm" master-name="page"> ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.