Creating a Page Master: fo:simple-page-master

Creating a Page Master: <fo:simple-page-master>

As you can gather from its name, a page master is a template that is used to generate a page. A page master specifies the actual layout and geometry of a page. Each page master has a unique name, and you refer to it by that name when you want to use it.

In the current XSL specification, only one kind of page master is available, <fo:simple-page-master> , and I use that element to format pages here. You can use the following XSL-FO properties with the <fo:simple-page-master> object (see Appendix B for an explanation of these properties):

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

  • master-name

  • page-height

  • page-width

  • reference-orientation

  • writing-mode

In the XSLT stylesheet I use on planets.xml, I give the simple page master the name page using the master-name property. That names the master, and when I want to create pages using this master, I refer to it by this name. I also specify the page dimensions and margins using page and margin properties as follows :

 <?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">                       .                       .                       .      .      .      . 

In addition to laying out the margins of a page, an <fo:simple-page-master> has children that specify one or more regions in the page, which enables you to customize the layout in detail.



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