Creating Flows: fo:flow

Creating Flows: fo:flow

Flow objects are called that because the text in them "flows" and is arranged to fit the page by the displaying software. The content of a page is handled with flow objects.

There are two kinds of flow objects: fo:static-content and fo:flow . A fo:static-content flow object holds content, such as the text that goes into headers and footers that are repeated on the pages of the page sequence. The fo:flow flow object, on the other hand, holds the text itself that makes up the content of the document. The following fo:flow object has a single property: flow- name .

I'll add a fo:flow object to ch14_02.xsl to handle the text content of ch14_01.xml. To make sure that the text content of ch14_01.xml is transformed into that flow, I'll use an <xsl:apply-templates> element, which we first saw in the previous chapter. The <xsl:apply-templates> element will make the XSL processor process the various elements in ch14_01.xml (note that I also add the declaration of the xsl namespace) and insert them into the flow:

 <?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>              <fo:page-sequence master-reference="page">  <fo:flow flow-name="xsl-region-body">   <xsl:apply-templates/>   </fo:flow>  </fo:page-sequence>         </fo:root>     </xsl:template>     .     .     . 

That completes the fo:page-sequence object; we've specified a master to use for this sequence and provided the XSL processor a way to get the content that will go into the pages in the formatted document. Besides fo:flow , there's another flow object: fo:static-content .

Creating Static Content: fo:static-content

The fo:static-content formatting object holds formatting objects that are to be presented in a single region or repeated in regions on one or more pages in the page sequence. It is most often used to create repeating headers and footers, because its content is repeated on every page to which it is assigned.

You can use the property flow-name with the fo:static-content formatting object.



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

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