XML
  Home arrow XML arrow Using Regions with XSL Formatting Objects
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

Using Regions with XSL Formatting Objects
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2009-06-02

    Table of Contents:
  • Using Regions with XSL Formatting Objects
  • Defining Additional Regions
  • Placing Content Within Regions
  • A Short Example

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using Regions with XSL Formatting Objects


    (Page 1 of 4 )

    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.

    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. 

    More XML Articles
    More By Peyton McCullough


     

    XML ARTICLES

    - 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
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek