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: background image for the rear cover page


Nancy Brandt <nancy_brndt <at> yahoo.com> writes:

> 
> 
> Hello my friends,
>
> Owing to your various suggestions, and to Bob Stayton's book, I have
> successfully created a front cover page (with a background image) by
> customizing the titlepage-first pagemaster in pagesetup.xsl. Now, I would
> like to create a rear cover page by putting a background image on the last
> page in a document. Does anybody have an idea how to do it? I haven't seen
> any template which handles the last document page.
>
> Please advise!
>
> Thanks in advance
>
> Nancy 
>  
> 

I finally worked out how to do it. In case you have not found the answer:

There are templates called front.cover and back.cover that are
empty by default. Try the stylesheet below. It defines a parameter
back.cover with default value 'back-cover.png'. Remember to set the
parameter or rename your background image.

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
                xmlns:fo="http://www.w3.org/1999/XSL/Format";
                xmlns:d="http://docbook.org/ns/docbook";
                version="1.0">
  <!-- Change the path to match your system --> 
  <xsl:import
      href="/PATH/TO/fo/docbook.xsl"/>

  <!--
      Assumption: You are not using any elements from your book on the
      back cover. That is, you will design the cover in your favourite
      desktop publishing program and save the result as an 8.5in X
      11in (or whatever size) image.
  -->

  <!-- Step 1: Define global parameter for background image -->
  <xsl:param name="back.cover" select="'back-cover.png'"/>

  <!--
      Step 2: Define your own simple-page-master. Basically, set all
      margins to 0 so that the graphic will take up the entire page
  -->
     
  
  <xsl:template name="user.pagemasters">

    <fo:simple-page-master master-name="back-cover"
			   page-width="{$page.width}"
			   page-height="{$page.height}"
			   margin-top="0"
			   margin-bottom="0"
			   margin-left="0"
			   margin-right="0">
      <fo:region-body margin-bottom="0" margin-top="0"
		      column-gap="{$column.gap.back}"
		      column-count="{$column.count.back}"
		      background-image="url({$back.cover})"/>
      </fo:simple-page-master>
  </xsl:template>

  <!--
      Step 3: Customise the "back.cover" template
  -->

  <xsl:template name="back.cover">
    <!-- Use your custom page-master -->
    <fo:page-sequence master-reference="back-cover">
      <fo:flow flow-name="xsl-region-body">
	<fo:block/> <!-- nothing  on page but background graphic -->
      </fo:flow>
    </fo:page-sequence>

  </xsl:template>

</xsl:stylesheet>






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