How to produce a titlepage in fo
If you look in the doc directory of the 1.48 stylesheet distribution, in the template directory, you should find a file called
Based on that file and my own errors, this is what I do to produce a reasonable titlepage in my fo output.
Starting point. In the 1.48 distribution, in directory template (not doc/directory) you will find a file called
Let's create an xml document called mytitlepage.xml, something like this.
Example 1. Titlepage, a starting point
(1). The base stylesheet location is the path to the main stylesheet.
(2). Set this to true if you want sections numbering.
(3). I want this lot to appear as the front page of a book, rather than an article or other element. Since I'm aiming for an fo output, set the wrapper to fo:block, as apposed to a div for an html front page.
(4). In terms of content for this particular front page I want the content to be all the stuff within this wrapper. I also want this stuff to appear on the recto page... OK, the right hand page if you must. Were I true to form I would set this to 'verso', the opposite of recto. Note that I only want the first title element, and the first subtitle element, hence the use of the  predicate here.
if you want to also create a verso page, you add another <t:titlepage side="verso"> element that lists the elements you want on the back of the recto titlepage.
(6). author, contrib, edition, copyright, pubdate, revision? If you are familiar with docbook then these should strike you as being children of the bookinfo/articleinfo type of elements in docbook. Basically anything you can put in there, can go in here.
To put an image on a titlepage, you put a <mediaobject> element inside your <xxx info> element in your document. The <mediaobject> element specifies which graphic to use, and simply add it to the list, in the same way as other content is added.
Note that the order in which information is shown on the titlepage isn't necessarily the same as the order in which information is added within the xxxinfo section of your document. The order specified in mytitlepage.xml is the order in which stuff will be laid out.
So, thats the first job done. I've defined an XML document which specifies what I actually want on my front page. Now what?
The stylesheet distribution comes with a stylesheet called titlepage.xsl, again in the template directory. Use the file you created based on the above, and this stylesheet, to create another stylesheet which will create your front page. Follow that? Again. Use titlepage.xsl (from the templates directory), to process the xml file similar to the one above, and it will produce a file which you can then use to style your main document to produce the front page you need. For example.
This produces the output file /sgml/book/titlepage.xsl which is ready for use. So. Let's assume you have some customisation in a file called mydocbook.xsl, which calls up the main xsl docbook stylesheet. In that file you need to add the line which includes the titlepage processing (/sgml/book/titlepage.xsl in the example above). Something like.
So the processing sequence then applies your customisations, includes the titlepage processing and produces the needed output.
Images on a titlepage
| Is it possible to have an image on a book's titlepage in
The right element is mediaobject with an imageobject inside it. But you'll also have to tinker with the titlepage setup
See my article
Layout driven title page
I think for a layout-driven title page where you know exactly what you want, you are better off abandoning the title page generator process. The stylesheet generator is useful when you just need to select the titlepage elements and their order. But getting it to generate a complex FO table is harder than simply writing the FO table as an XSL template as you have done.
So just create a file named something like mytitlepage.xsl containing what you want:
<xsl:stylesheet etc. > <xsl:template name="book.titlepage.recto"> <fo:block> <fo:table border-width="0.1pt" border-style="solid"> <fo:table-column column-width="50mm"/> <fo:table-column column-width="50mm"/> <fo:table-column column-width="50mm"/> <fo:table-body> <fo:table-row > <fo:table-cell border-width="0.1pt" border-style="solid"> <fo:block> ORIGINATOR : <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="b ookinfo/corpauthor"/> </fo:block> </fo:table-cell > [etc.] </xsl:template> </xsl:stylesheet>
And then add this line to your fo customization layer after you import the main fo stylesheet:
Your template will simply override the default of the same name, and you don't have to do any maintenance when you upgrade the stylesheet release.
You may want further control over how particular elements are handled (for example, the default handling of corpauthor is to precede it with the word "by"). You could add a template like:
<xsl:template match="bookinfo/corpauthor" mode="book.titlepage.recto.mode"> <fo:block> <xsl:text> </xsl:text> <xsl:apply-templates/> </fo:block> </xsl:template>
And do that for any other element you need special handling for on the title page.
Using entities in titlepage templates
Yes, there is a way. Start your template by this code:
<?xml version="1.0"?> <!DOCTYPE t:templates [ <!ENTITY % ISOnum PUBLIC "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML" "path/to/ent/iso-num.ent"> %ISOnum; ... repeat above for all entity sets you want to use ... ]> <t:templates xmlns:t="http://nwalsh.com/docbook/xsl/template/1.0" xmlns:param="http://nwalsh.com/docbook/xsl/template/1.0/param" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
The stylesheets assume a bibliography is at the same level as chapter. As with most elements, the title is handled by the stylesheet titlepage mechanism. The specs for bibliography titles are in fo/titlepage.templates.xml. It shows that the <title> element of bibliography is handled by the 'component.title' template, which is used for chapters and such.
To change it, you should edit a copy of titlepage.templates.xml, generate your own titlepage.templates.xsl, and include that in your stylesheet customization. You could have the specs call a new template such as "bibliography.title" instead of component.title. That template could check to see if the parent element is something other than book, and if so apply smaller formatting properties. If the parent is book, then call component.title.
Don't try to just put something in the empty template with match="bibliography/title". That is empty because the title element is handled by the template for the bibliography element. That empty template prevents the title from being processed (and output) twice. This is a method commonly used in the stylesheets.
BTW, there is talk in the DocBook Technical Committee about adding a more lightweight bibliolist element for minor bibliographies within other elements. This is analogous to glosslist and glossary.
Chapter title layout
You should take a look at the template named 'component.title' in fo/component.xsl. The titlepage.templates.xml specification file specifies that this template should be used to process chapter and other component titles.
I would suggest you change titlepage.templates.xml to call a new template such as 'chapter.title' instead of component.title, and add the 'chapter.title' named template to your customization layer. It needs to generate three fo:blocks stacked one after another for 'Chapter', '5', and the title, and with the text-align="right" property set. You can add any other attributes you feel necessary to format the title as well. Inside each fo:block template, you call templates to generate the text for that block.
To generate the word 'Chapter', you want to call the template named 'gentext' with a parameter named 'key' whose value is the string 'chapter'. That will look up the generated text label in the right language.
<xsl:call-template name="gentext"> <xsl:with-param name="key" select="'chapter'"/> </xsl:call-template>
To generate the chapter number, use apply-templates with mode="label.mode"
<xsl:apply-templates select="." mode="label.markup"/>
To generate the chapter title, use:
<xsl:apply-templates select="." mode="title.markup"/>