No page break in docbook

400 Views Asked by At

I went the docbook way for a book I am writing. Many nice things but, after a lot of work, I came to regret it. I am using XMLmind for the rendering part (and Bbedit for the editing). The last drop was when I realized there is no easy way of inserting a page break in a docbook document. That is, unless you study all the XSL documentation and try to use different style sheets than those XMLmind's uses.

From http://www.sagehill.net/docbookxsl/PageBreaking.html I see I should put

<xsl:template match="processing-instruction('hard-pagebreak')">
   <fo:block break-after='page'/>
 </xsl:template>

somewhere, and

<?hard-pagebreak?>

where I need to force a page break. But the point is: being this the header of the xml file processed by XMLmind:

<book version="5.1" xml:lang="it" xmlns="http://docbook.org/ns/docbook"
      xmlns:xlink="http://www.w3.org/1999/xlink"
      xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:trans="http://docbook.org/ns/transclusion"
      xmlns:svg="http://www.w3.org/2000/svg"
      xmlns:m="http://www.w3.org/1998/Math/MathML"
      xmlns:html="http://www.w3.org/1999/xhtml"
      xmlns:db="http://docbook.org/ns/docbook">

where should the template be added?

Answering to your question, the original code is:

<?xml version="1.0" encoding="UTF-8"?>
<book version="5.1" xml:lang="it" xmlns="http://docbook.org/ns/docbook"
      xmlns:xlink="http://www.w3.org/1999/xlink"
      xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:trans="http://docbook.org/ns/transclusion"
      xmlns:svg="http://www.w3.org/2000/svg"
      xmlns:m="http://www.w3.org/1998/Math/MathML"
      xmlns:html="http://www.w3.org/1999/xhtml"
      xmlns:db="http://docbook.org/ns/docbook">
  <info>
    <title>This is a book</title>
  </info>

  <chapter xml:id="ch_intro">
    <title>Introduction</title>

    <section xml:id="first_section">
      <title>The first section</title>

      <para>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do 
      eiusmod tempor incididunt ut labore et dolore magna aliqua. 
      Ut enim ad minim veniam, quis nostrud exercitation ullamco 
      laboris nisi ut aliquip ex ea commodo consequat.</para>
    </section>

    <section xml:id="second_section">
      <title>The second section</title>

      <para>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do 
      eiusmod tempor incididunt ut labore et dolore magna aliqua. 
      Ut enim ad minim veniam, quis nostrud exercitation ullamco 
      laboris nisi ut aliquip ex ea commodo consequat.</para>
    </section>
  </chapter>
</book>

I'd like to insert a page break between the first and the second section.

0

There are 0 best solutions below