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] How do I customize docbook/fo stylesheet to do custom page breaks on sections?

Hi Jon,
Unless global params, an attribute-set is evaluated each time it is used, in the context of the element being processed.  So  putting an xsl:choose inside the body of an xsl:attribute element works, but be sure to include an xsl:otherwise so you don't get an empty attribute.
In your case, I would recommend adding a role attribute to the special chapter, rather than relying on its position in the document (which can change).  If you used <chapter role="StatementDefs">, then your stylesheet could use:
<xsl:attribute-set name="section.level1.properties">
  <xsl:attribute name="break-before">
      <xsl:when test="ancestor::chapter/@role = 'StatementDefs'">page</xsl:when>
This feature of XSLT is very handy for stuff like this.
Bob Stayton
Sagehill Enterprises
----- Original Message -----
From: Jon Rosen
Sent: Thursday, October 06, 2011 12:39 PM
Subject: [docbook-apps] How do I customize docbook/fo stylesheet to do custom page breaks on sections?

I have no idea if anyone on this forum will be familiar enough with Docbook and the XSL-FO stylesheets for creating PDFs but I need to figure out how to customize my stylesheet template so that I can do pagebreaks differently for each chapter.

There is a standard param element to set page breaks on sections:

<xsl:attribute-set name="section.level1.properties">
<xsl:attribute name="break-before">page</xsl:attribute>

But this is universal, i.e., ALL chapters in the book get set with this property. Chapter 4 has statement definitions for each element of our SQL language and because of the layout, we would like each section to start on a new page. However, the other chapters have lots of very small sections at the sect1 level and when they page-break, the book looks awful.

So I want chapter 4 to do this, but on the other chapters, I just want regular non-breaking section 1 headings.

I figure I need some kind of "xsl:if" statement that tests the chapter number and puts in this attribute modification just for chapter 4 but I have no real idea how to find out what variable has the chapter numbers to compare and where to put this test (xsl is still a bit mysterious to me although I am getting more familiar all the time).

Any help would be GREATLY appreciated!

Jon "bleurose" Rosen

PS - feel free to email me directly.


Jon Rosen

"Sometimes you're the pinball wizard, and sometimes you're just the pinball."


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