Creating Regions

Creating Regions

In version 1.0 of the XSL specification, page masters have five regions. The central region, which corresponds to 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 . The start and end regions are like sidebars that flank the body region.

The following XSL-FO elements 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 the following elements:

  • 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 the XSLT stylesheet, where I set margins for the body region. The four outer regions (but not the body region) have an extent property that sets their size , and I 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 xmlns:fo="http://www.w3.org/1999/XSL/Format">              <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 completes the master I use in this document, the simple page master named page, so that completes the <fo:layout-masterset> element as well.

In addition to the <fo:layout-masterset> , a formatting object document usually also contains one or more <fo:pagesequence> elements that define page sequences using the masters you define in the <fo:layout-masterset> , and I add a page sequence here.



Inside XSLT
Inside Xslt
ISBN: B0031W8M4K
EAN: N/A
Year: 2005
Pages: 196

Similar book on Amazon

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