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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Arian Hojat
(btw using fop trunk)
So I have a lastpage id put on a blank fo:block at the end of the last
page-sequence Im creating ... but its showing up as the real count but
minus 1, for certain situations my xsl creates (but i want those
situations, as i want to use page-position="last")...

So I have a larger static-content footer which shows up on the last
page of each page-sequence, so imagine looping through student nodes
and on each of their last pages a footer is displayed with a large
'Parents Comments:' block added (this is set via
<fo:conditional-page-master-reference page-position="last")... So when
there is just enough content that pushes the footer out onto a new
page, the last page is blank since it was just enough flow content to
create a new page, but not enough to actually put any content on the
last page (hence the blank page for each page-sequence Im creating
where the content flows like this )...

So basically the <fo:block id="lastpage"></block> i think is with the
flow content on the page before the last blank page... and the total
page count turns out minus 1 in certain situations. Is there any
solution to this? I was hoping a property like  <fo:block
id="lastpage" putThisEmptyBlockOnTheNextPageIfOneIsAvailable="true"></block>
 haha.

-Thanks for any suggestions,
Arian

Reply | Threaded
Open this post in threaded view
|

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

Arian Hojat
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">
          <fo:repeatable-page-master-alternatives>
            <fo:conditional-page-master-reference
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 -->
            <fo:conditional-page-master-reference
master-reference="student_pages_master_otherPagesIfMultiplePages"
page-position="any" /> <!-- 1 to (nth-1) page if multiple pages -->
          </fo:repeatable-page-master-alternatives>
        </fo:page-sequence-master>

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

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 -->
        </fo:page-sequence>
      </xsl:for-each>


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

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

-Arian



On Mon, Apr 19, 2010 at 4:07 PM, Amick, Eric <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

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

Tony Graham-3
On Mon, Apr 19 2010 22:26:59 +0100, [hidden email] wrote:
...

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

This might or might not work:

 - Put no footer on the last page, and extend the fo:region-body to
   include the area you use for the footer

 - Put the parent's comments block as the last content in the fo:flow.

 - Put the parent's comments block inside a fo:block-container with
   display-align="after", block-progression-dimension.minimum set to the
   height of the comment block, and the .optimum and .maximum set to the
   height of the last page's fo:region-body.

 - Fake the page number on the last page by having it refer to it's own
   page number.

Success would depend on how willing the formatter is to make the block
container less than the optimum height to fit it on the page rather than
putting it on the next page.  You could try setting
keep-previous.within-page or setting the .optimum fractionally smaller
than the .maximum to see if that makes any difference.

Regards,


Tony Graham                         [hidden email]
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd                               XML Guild member
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2