In my last article on XSL Formatting Objects (XSL-FO), we took a look at the basics. We created a simple page master with one body region and then wrote some text onto the page. However, XSL-FO offers a lot more functionality and flexibility. In this article, we'll take a closer look at regions.
Using Regions with XSL Formatting Objects - Defining Additional Regions (Page 2 of 4 )
Now let's take a look at the other regions available, one at a time.
The next region we'll take a look at is the top region. The top region is placed, of course, on the top of the page. This is a page's header. In the case of a page out of a book, the name of the book or chapter might go here.
In order to define this region, the region-before tag is used (this may seem odd, since the area it refers to is more intuitively called the top of the page or the header, but the region contains the content "before" everything else). This tag goes inside of the page master definition, just like the body region definition, but it must be placed after the body region's definition. This holds true for all non-body regions.
Here's a basic example of a master page with two region definitions, one for the body region and one for the top region:
The default name for the top region is "xsl-region-before."
The next logical step here, since we just looked at the top region, is to look at the bottom region. This region is traditionally called the page's footer. The corresponding tag, however, is called region-after, since the region is located after the other regions. Here's an example definition:
The default name for the bottom region is "xsl-region-after."
We've now looked at the regions corresponding to the top and bottom of a page. We can also place text on the left and right sides of a page. The region on the left of a page is the left region, and it's defined using the region-start tag:
Its default name is, of course, "xsl-region-start."
The region on the right of a page is the right region, and it's defined using the region-end tag:
As expected, "xsl-region-end" is the default name.
Like the top and bottom regions, the names of the left and right regions may seem a bit non-intuitive, but they might make sense if we take a look at exactly where the regions are located on the page. The top region is located before all other regions, and the bottom region is located after all other regions. So, the left and right regions are both located entirely between the top and bottom regions. Think of them as the start and end of this middle section of the page.