Forum How do I...?

Struggling to insert a page break

jean
Hi there

Amongst many other divs, I have a couple of appendices. They all start like this (with different names and ids, of course):
    <div class="appendix" lang="en">
      <h2 class="title" style="clear: both"><a name="appendix_a" id="appendix_a"></a>A.&nbsp;Databases to be backed up</h2>

      <div class="glosslist">


I want to put a page break before the first one. This doesn't work:
a[name="appendix_a"] {
    page-break-before: always;
}


Any suggestions on how to do this?
mikeday
Page breaks can't be applied to inline elements, like <a>. How about moving the id attribute to the h2 element? That way the page break will work, and it will also look a bit more up to date, with the <a name> only there as a fallback for any browsers that don't look at id attributes (although I think all browsers respect id attributes now, and have for some time).
jean
mikeday wrote:
How about moving the id attribute to the h2 element?


Still the same reason as before: the HTML is generated from DocBook XML, and I don't want to fiddle with the XSL if I can avoid it at all.

mikeday wrote:
Page breaks can't be applied to inline elements, like <a>.


Fair enough, but I wish prince would do the only reasonable thing (the way it usually does), namely to put the break at the first place where it makes sense. After all, the rule doesn't say 'page-break-immediately-before-this-specific-element' :wink:
mikeday
It might be a good idea to raise this issue with the maintainers of the DocBook XSLT system as well, as the markup they are generating for this case is really sub-optimal for easy styling.
jean
Done.

My post should show up here once the archive catches up: http://lists.oasis-open.org/archives/docbook/200804/maillist.html