Creating Regions

Creating Regions

In version 1.0 of the XSL recommendation, page masters have up to five regions. The central region, which corresponds to the body of the page, is called the body region. The top part of the page, the header, is called the before region; the bottom part of the page, the footer, is called the after region. In languages that read left to right, such as English, the left side of the page is called the start region and the right side is called the end region. In languages that read right to left, the start and end regions are reversed . You can think of start and end regions as sidebars that flank the body region.

XSL formatting objects correspond to these regions:

  • fo:region-before

  • fo:region-after

  • fo:region-body

  • fo:region-start

  • fo:region-end

You can use these properties with these formatting objects:

  • Common border, padding, and background properties: background-attachment , background- color , background-image , background-repeat , background-position-horizontal , background-position-vertical , border-before-color , border-before-style , border-before-width , border-after-color , border-after-style , border-after-width , border-start-color , border-start-style , border-start-width , border-end-color , border-end-style , border-end-width , border-top-color , border-top-style , border-top-width , border-bottom-color , border-bottom-style , border-bottom-width , border-left-color , border-left-style , border-left-width , border-right-color , border-right-style , border-right-width , padding-before , padding-after , padding-start , padding-end , padding-top , padding-bottom , padding-left , padding-right

  • Common margin properties for blocks: margin-top , margin-bottom , margin-left , margin-right , space-before , space-after , start-indent , end-indent

  • clip

  • column-count

  • column-gap

  • display-align

  • extent

  • overflow

  • region- name

  • reference-orientation

  • writing-mode

You can customize the regions of a page as you like, as in ch14_02.xsl, where I'm setting margins for the body region. The four outer regions (but not the body region) have an extent property that sets their size, and I'll use that here:

 <?xml version='1.0'?>  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"     xmlns:fo="http://www.w3.org/1999/XSL/Format"     version='1.0'>     <xsl:template match="PLANETS">         <fo:root>             <fo:layout-master-set>                  <fo:simple-page-master master-name="page"                      page-height="400mm" page-width="300mm"                      margin-top="10mm" margin-bottom="10mm"                      margin-left="20mm" margin-right="20mm">  <fo:region-body   margin-top="0mm" margin-bottom="10mm"   margin-left="0mm" margin-right="0mm"/>   <fo:region-after extent="10mm"/>  </fo:simple-page-master>              </fo:layout-master-set>     .     .     . 

That ends the only master I'll have in this document: the simple page master named page . That completes the fo:layout-master-set object.

As mentioned, besides the fo:layout-master-set , a formatting object document usually also contains one or more fo:page-sequence objects that define page sequences using the masters you define in the fo:layout-master-set .



Real World XML
Real World XML (2nd Edition)
ISBN: 0735712867
EAN: 2147483647
Year: 2005
Pages: 440
Authors: Steve Holzner

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net