OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] adding a footer only to last page


Thanks Bob. I'll try to make it work.

Robert

On Fri, Mar 9, 2012 at 6:27 AM, Bob Stayton <bobs@sagehill.net> wrote:
Unfortunately, that example I had was work I did for a client, so I'm not at liberty to copy you on it.

It involved several pieces that I can outline for you.

1.  Customize the template named 'user.pagemasters' to define a new simple-page-master for the last page, with a master-name such as 'body-last".  On that master, set the bottom page and body margins to make room for your footer.  Modify its fo:region-after to have an extent large enough for your text.  Also, rename the region-name to something new like "xsl-region-after-last".

2.  Define a new page-sequence-master that copies the body master but adds the last page as another conditional reference:

<fo:conditional-page-master-reference master-reference="body-last"
                                              page-position="last"/>

3.  Customize the template named 'running.foot.mode' from fo/pagesetup.xsl to add another xsl:static-content element with attribute  flow-name="xsl-region-after-last". The content of that element would be your last page content.  You might just have it call a template, and then write the template to generate the content.  Because it is in a separately named region that only appears on the last page master, it would not appear on other pages.

4.  Customize the 'select.user.master' template from fo/pagesetup.xsl to apply your new page master for articles.

As you can see, this is a lot of pieces, and if it does not work it may not be clear where it is going wrong.


Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- From: robert
To: Bob Stayton
Sent: Sunday, March 04, 2012 12:12 PM
Subject: Re: [docbook-apps] adding a footer only to last page


Footnote is an option, but it will not work well for more complicated cases. Let's say the same footer on all pages in the right corner, and some content that should appear within the footer area only on the last article page. I'm still very curious have to achive that using the footer mechanism.


Robert


On Sun, Mar 4, 2012 at 8:46 PM, Bob Stayton <bobs@sagehill.net> wrote:

You can put a footnote at the end of each article that would appear at the bottom of the last page. In XSL-FO, the fo:footnote element is typically used for floats that are to appear at the bottom of the page.  You would want to customize the footnote a bit to avoid the footnote number.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- From: robert
To: Bob Stayton ; docbook-apps@lists.oasis-open.org
Sent: Sunday, March 04, 2012 6:12 AM
Subject: Re: [docbook-apps] adding a footer only to last page


Thanks Bob for your help.


I'm wondering if there is other way do achive a similar result. I want to have an image and some text at the bottom of each page that ends an article. I though a footer would be an obvious solution, but maybe there is other way to put that content at the bottom of a page. My book is generated dynamically, so for example, I'm able to add that content to each article, if that would allow me to use some other mechanism and simplify the solution.


Robert


On Fri, Mar 2, 2012 at 6:23 PM, Bob Stayton <bobs@sagehill.net> wrote:

Hi Robert,
Ah, sorry, this is actually a bit more complicated than I remembered.  The DocBook XSL stylesheets  are not set up with page-masters for 'last', and so that all has to be set up before the $sequence='last' in footer.content will work.  I'll see if I can dig up an example of a working version.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- From: robert
To: Bob Stayton
Sent: Friday, March 02, 2012 1:16 AM
Subject: Re: [docbook-apps] adding a footer only to last page


Hi Bob,


I can't get this working and have no idea what I'm doing wrong.
My customization layer contains the following:


<xsl:param name="footer.rule" select="0"></xsl:param>


<xsl:attribute-set name="footer.content.properties">
 <xsl:attribute name="background-color">red</xsl:attribute>
</xsl:attribute-set>


<xsl:template name="footer.content">
 <xsl:param name="pageclass" select="''"/>
 <xsl:param name="sequence" select="''"/>
 <xsl:param name="position" select="''"/>
 <xsl:param name="gentext-key" select="''"/>
 <fo:block>
  <xsl:choose>
    <xsl:when test="$double.sided = 0 and $position='left' and self::d:article and $sequence = 'last'">
      www.foo.com
    </xsl:when>
    <xsl:otherwise>
      <!-- nop -->
    </xsl:otherwise>
  </xsl:choose>
 </fo:block>
</xsl:template>


When I apply this do a book with several articles, i.e.:


<book xmlns:xi="http://www.w3.org/2001/XInclude"
 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook"
 version="5.0">
 <info>
  <title>Media Access Proxy™</title>
 </info>
 <article xml:id="a1">
  ...
 </article>
 <article xml:id="a2">
  ...
 </article>
</book>


I would like to see (in a PDF file) the 'www.foo.com' text at the left bottom of the page on the red background twice (i.e. at the end of each article). But I see a box with the red background on all pages and the text never appears.






Thanks for your help.
Robert








On Thu, Mar 1, 2012 at 6:57 PM, Bob Stayton <bobs@sagehill.net> wrote:

Hi Robert,
The general instructions for customizing headers and footers can be found here:

http://www.sagehill.net/docbookxsl/PrintHeaders.html

The footer.content template is a big xsl:choose statement that sets conditions for which pages have which output.  In your case, each article generates a page-sequence, so that is the context when the template is called. The xsl:when statement might look something like this:

<xsl:when test="self::d:article and ($sequence = 'last' or $sequence = 'blank')">

You would need the 'blank' condition if you are doing double-sided output that may generate a blank page as the last page at the end of an article.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- From: robert
To: docbook-apps@lists.oasis-open.org
Sent: Thursday, March 01, 2012 3:21 AM
Subject: Re: [docbook-apps] adding a footer only to last page


To simplify the problem. Let's only consider the case when there is a book with a number of articles, and the footer must only be added to the last page of each article.


On Thu, Mar 1, 2012 at 10:57 AM, robert <rp.info@gmail.com> wrote:

Hi All,

I have two somehow similar problems. Both relate to printed output.

1. I have a book with a number of articles and want to have a footer
only on the last page of each article and the last page of the whole
book.
2. Similarly, I have a set of books, and want to have a footer only on
the last page of each book.

Have can I do it?

Thanks,
Robert



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]