Home arrow XML arrow Using Regions with XSL Formatting Objects
XML

Using Regions with XSL Formatting Objects


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.

Author Info:
By: Peyton McCullough
Rating: 4 stars4 stars4 stars4 stars4 stars / 8
June 02, 2009
TABLE OF CONTENTS:
  1. · Using Regions with XSL Formatting Objects
  2. · Defining Additional Regions
  3. · Placing Content Within Regions
  4. · A Short Example

print this article
SEARCH DEVARTICLES

Using Regions with XSL Formatting Objects
(Page 1 of 4 )

XSL-FO defines several levels of areas with which we can work. The highest level is the page, and the next level after this is the region. A region is, in the simplest terms, a section of a page. Each page contains five regions, which correspond to different areas of the page. Using regions, it's possible to place content appropriately.

For example, consider a page of a book. The page could be divided up into multiple regions, each containing different bits of information. The text of the page, for instance, would go into one region, and the page number would go into another. Later, we'll be able to use the various regions to design the page of a book.

Regions are defined inside of the page master to which they belong. In the last article, we examined the body region, defined using the region-body tag. There are more region types, but we'll start by looking at the body region, since it's the most important. A body region definition might look something like this: 

<fo:region-body region-name="xsl-region-body" />

Note that the name "xsl-region-body" is traditionally used for body regions. In fact, it's the default value, so there's no need to explicitly state the name like we did above. You're free to use whatever name you want, but if you're lacking in creativity, then this value will do. Besides, when the region is referenced elsewhere in the XSL-FO document, the region's type will be unambiguous. The other regions also have default names like this. 

This region contains, as the name suggests, the body of the page. This is where the page's primary content is contained. In the case of a page out of a book, the actual text would go here. In order to actually place the text within the region, the flow element is used. For example, to flow content into the body region we created earlier, we'd do something like this: 

<fo:flow flow-name="xsl-region-body"> <fo:block>Hello, world.</fo:block></fo:flow>

As you can see, working with body regions alone is very simple. 


blog comments powered by Disqus
XML ARTICLES

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials