Re: [xsl] xsl help adding a footer with page number

Subject: Re: [xsl] xsl help adding a footer with page number
From: JBryant@xxxxxxxxx
Date: Fri, 8 Apr 2005 14:36:53 -0500
Hi, Josh,

Here's a simplified version of one of my page definitions:

<fo:simple-page-master master-name="main" 
xsl:use-attribute-sets="pagedef">
  <fo:region-body region-name="main" margin-top="1in" 
margin-bottom="1in"/>
  <fo:region-before region-name="header-main" extent="1in"/>
  <fo:region-after region-name="footer-main" extent="1in"/>
</fo:simple-page-master>

Note that the regions have names.

And here's the corresponding flow definition (much simplified, of course):

<fo:page-sequence master-reference="main">
  <fo:static-content flow-name="header-main">
    <fo:block xsl:use-attribute-sets="header">
      <fo:external-graphic src="logo.gif"/>
    </fo:block>
  </fo:static-content> 
  <fo:static-content flow-name="footer-main">
    <fo:block xsl:use-attribute-sets="footer">
      <fo:page-number/>
    </fo:block>
  </fo:static-content> 
  <fo:flow flow-name="main">
    <!-- Build the document here -->
  </fo:flow>
</fo:page-sequence>

The static-content chunks flow into the before and after regions, and the 
main flow goes in the usual flow area. In this fashion, you can build a 
series of different page definitions. I generally use front (for the title 
page and copyright notices and such), contents (for the table of 
contents), main (for the body of the book), and back (for the appendixes, 
glossary, and index). So most of my book definition FO files have 4 page 
masters and 4 corresponding page-sequence objects, each with 
static-content ojbects (that match the regions defined in the page 
masters) for the headers and footers.

Let me know if you need more explanation. Also, you FOP distribution has 
several examples to examine.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)





josh higgins <doopsterus@xxxxxxxxx> 
04/08/2005 02:17 PM
Please respond to
xsl-list@xxxxxxxxxxxxxxxxxxxxxx


To
xsl <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
cc

Subject
[xsl] xsl help adding a footer with page number






I have the following template specified and I was
trying to add a custom footer to this document.  I am
using FO and not html.  All I want in the footer is
the page number followed by the word "CURRENT".  How
can I do this? 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:fo="http://www.w3.org/1999/XSL/Format";>

 <xsl:template match="/">
  <fo:root
xmlns:fo="http://www.w3.org/1999/XSL/Format";>
 
   <fo:layout-master-set>
     <fo:simple-page-master master-name="simple"
                   page-height="11in" 
                   page-width="8.5in"
                   margin-top=".5in" 
                   margin-bottom=".5in" 
                   margin-left=".5in" 
                   margin-right=".5in">
     <fo:region-body margin-top=".5in"/>
       <fo:region-before extent=".5in"/>
       <fo:region-after extent=".5in"/>
     </fo:simple-page-master>
   </fo:layout-master-set>
 
 
   <fo:page-sequence master-reference="simple">
                 <fo:flow flow-name="xsl-region-body">
                                 <!-- I have fo:blocks displayed items 
here -->
                 </fo:flow>
   </fo:page-sequence>
  </fo:root> 
 </xsl:template>


 
__________________________________ 
Do you Yahoo!? 
Yahoo! Personals - Better first dates. More second dates. 
http://personals.yahoo.com

Current Thread