W3C home > Mailing lists > Public > www-xsl-fo@w3.org > April 2010

Re: referring to a page number on last page (when last page is blank)

From: Arian <armyofda12mnkeys@gmail.com>
Date: Mon, 19 Apr 2010 17:26:59 -0400
Message-ID: <j2s797650581004191426i44279055g973c3905134328fc@mail.gmail.com>
To: "Amick, Eric" <Eric.Amick@mail.house.gov>, www-xsl-fo@w3.org
Hey Eric,
Posting to my thread as well so it clarifies some things on how my
code looks like ...

Well the footer appears once per student (on the last page of each
student's page-sequence), and the lastpage reference occurs once
overall for the last student at the end of its flow ...
Maybe can follow along with the code better:


        <fo:page-sequence-master master-name="student_pages_master">
master-reference="student_pages_master_lastpage" page-position="last"
/> <!-- On last page, or if just 1 page created then will be layout of
1st page -->
page-position="any" /> <!-- 1 to (nth-1) page if multiple pages -->

So student_pages_master_lastpage is a layout for the last page with a
3" footer lets pretend ... it is automatically calculated to be put
into the last page of each student ... the other pages have a 1"

Now I loop through each student

      <xsl:for-each select="//student">
        <fo:page-sequence master-reference="student_pages_master">
          <xsl:call-template name="StudentPage_HeaderFooter"/> <!--
sets up static header footer for each student page -->
          <xsl:call-template name="StudentPage_Body"/> <!--  will flow
into pages for each student -->

At the end of the "StudentPage_Body" template, I have <xsl:if
test="position()=last()"><block id="lastpage"></block></xsl:if> to put
an element I can refer to for the absolutely last page of the last

I then refer to this via <fo:page-number-citation ref-id="lastpage" />
in my cover page page sequence... the problem is this ...

Lets say there is enough content to push 0.25 inches passed the 3"
footer  on page 2 of the first student...
So now fop calculates to move 'last' footer page to page 3. and there
is empty space on that page since...
On page 2, there is a 1inch footer now since its not the last page,
and before there would have been a 3inch footer. but it only pushed
passed 0.25in passed where the 3incher would have been. So there is
1.75 blank area on that page at the bottom ( so last 3 inches of the
page looks like = .25" text content in the region-body + 1.75" blank
space in region-body + my 1" region-after footer). so the page number
block will fall in that 1.75" blank area now for the last student, but
I want it on the 3rd blank page.

I can move the last page footer to the first page to solve the problem
if client is fine with that via page-position="first".
Then the footer only gets pushed when content is definitely gonna goto
the last page, and therefore the <fo:block id="lastpage"/> block will
always be on the last page ...

So back to yer suggestion, of putting the id in the static-content footer ...
In the xsl , I use <xsl:if test="position()=last()"><block
id="lastpage"></block></xsl:if> to test where to actually put my
lastpage id to reference, aka in the last //student ... but i dont
think this will work as for-each page created for the last student,
will have an id right called "lastpage"? Im not sure about creating
random id's in static-content via xsl's generate-id(.) to refer to
later.  I dont think id's were meant to be used on the static-content
areas to be referred to (well I'm not sure), ive only seen the
opposite, static content areas referring id's in the fo:flow like
"Page X of <fo:page-number-citation ref-id="lastpage"/>" stuff ...

Anyway Im prob going to move the 3" 'comments' footer to the first
page of each student, so lastpage block of the last student will
always be on the actual last page (unless can come up with another


On Mon, Apr 19, 2010 at 4:07 PM, Amick, Eric <Eric.Amick@mail.house.gov> wrote:
> I'm confused. I thought you said this footer appears only on that one page. If this footer appears once per student, you can always make the ID value dependent on the student somehow; perhaps you can figure out how to use an expression for the ID value.
Received on Monday, 19 April 2010 21:27:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:33 UTC