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 16:10:19 -0500
Only one thought occurs to me for this problem:

Every printer has a dead area around the edges of the page where it cannot 
print (because the feed mechanism needs to hold onto something). It could 
be that your PDF viewer is positioning the footer block above the dead 
spot. Then, because of the height of that block, the viewer thinks the 
footer block overlaps the body area. Meanwhile, the printer just does what 
it's told, so you get the correct printed output. Try bigger header and 
footer areas (.75 instead of .5, perhaps) and see if it clears up. Mind 
you, that's a guess, but I can't think of many things that would make an 
on-screen viewer be different than what the printer is doing.

Also, I should have removed the xsl:use-attribute-sets attributes from the 
blocks I posted last time. They are meaningless unless you have defined 
named attribute sets elsewhere (I do it in a separate file, so that I can 
easily fiddle with style choices). You can just remove them (or take up 
using the same trick, if you like).

By the way, a question very similar to this one (large images crowding 
into the footer) was just asked on the FOP mailing list. Since many of 
your problems are specific to FOP, I think you might do well to post some 
questions over there. You can subscribe here: 
http://xml.apache.org/fop/maillist.html. (I think I said it was on 
SourceForge in some other post; my bad - I must have been thinking of 
Saxon).

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





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


To
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
cc

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






J,

I am getting my text on my main page running in to my
footer is this a common problem.  Here is how I have
set up my page.  Ideas why this is happening.  Seems
like the text on the page goes all the way to the
bottom but does not do that when I print it off but
when I view the pdf it does.


   <fo:layout-master-set>
      <fo:simple-page-master master-name="main"
                   xsl:use-attribute-sets="pagedef">
                                   <fo:region-body region-name="main" 
                                                   page-height="11in" 
                                                   page-width="8.5in"
                   margin-top="0.5in" 
                   margin-bottom="0.5in"
                   margin-left="0.5in"
                   margin-right="0.5in"/>
                                   <fo:region-before 
region-name="header-main"
extent="0.5in"/>
                                   <fo:region-after 
region-name="footer-main"
extent="0.5in"/>
                   </fo:simple-page-master>
   </fo:layout-master-set>

   <fo:page-sequence master-reference="main">
                                 <fo:static-content 
flow-name="header-main">
                                     <fo:block 
xsl:use-attribute-sets="header">
                                       HEADER GOES HERE
                                     </fo:block>
                                   </fo:static-content> 
                                   <fo:static-content 
flow-name="footer-main">
                                     <fo:block text-align="center" 
font-size="8pt"
xsl:use-attribute-sets="footer">
                                       <fo:page-number/>
                                     </fo:block>
                                   </fo:static-content> 

                 <fo:flow flow-name="main">


--- JBryant@xxxxxxxxx wrote:

> 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
> 
> 



 
__________________________________ 
Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 
http://www.advision.webevents.yahoo.com/emoticontest

Current Thread