Next in thread →
Next in month →
Re: [docbook-apps] Don't break chapter's to recto pages
Hi, It looks like this line in the 'force.page.count' template is the problem: <xsl:when test="$element != 'chapter'">auto</xsl:when> Shouldn't that be $element = 'chapter' ? If you change it, I get each chapter starting on the next page. Bob Stayton Sagehill Enterprises ----- Original Message ----- From: Mathias Schindler To: Bob Stayton ; DocBook Apps Sent: Tuesday, October 13, 2009 6:18 AM Subject: AW: [docbook-apps] Don't break chapter's to recto pages Hey Bob, Here’s a dummy-xml which outputs the same results as my document: <book audience="user" version="5.0" xml:id="userguide" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink"> <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Test chapter</title> <para>test text</para> </chapter> <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Test chapter</title> <para>test text</para> </chapter> <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Test chapter</title> <para>test text</para> </chapter> <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Test chapter</title> <para>test text</para> </chapter> <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Test chapter</title> <para>test text</para> </chapter> <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Test chapter</title> <para>test text</para> </chapter> <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Test chapter</title> <para>test text</para> </chapter> </book> And here’s a screenshot of the TOC: http://img504.imageshack.us/i/toc.jpg/ In the first 2 chapter’s everything is fine(as you can see in the picture they only take one site each). But in the following chapter’s there’s always a blank page (infront?) after every chapter. I hope you can see my problem now. Thanks in advance, Mathias Schindler Von: Bob Stayton [mailto:] Gesendet: Montag, 12. Oktober 2009 17:58 An: Mathias Schindler Betreff: Re: [docbook-apps] Don't break chapter's to recto pages Hi Mathias, Just reviewing the XSL, I cannot see why this would not work. Can you provide a short XML input file that illustrates the problem? Bob Stayton Sagehill Enterprises ----- Original Message ----- From: Mathias Schindler To: Bob Stayton ; DocBook Apps Sent: Monday, October 12, 2009 1:52 AM Subject: AW: [docbook-apps] Don't break chapter's to recto pages Hello! With “half-double-sided” I mean that sometimes the pages switch between double-sided output(with odd and even pages) and single-sided output. But this issue only arises without the user.pagemaster! The main problem is that not every chapter wraps to the next page. Here are the complete customized templates: <xsl:template name="force.page.count"> <xsl:param name="element" select="local-name(.)"/> <xsl:param name="master-reference" select="''"/> <xsl:choose> <xsl:when test="$element != 'chapter'">auto</xsl:when> <xsl:when test="$double.sided != 0">end-on-even</xsl:when> <xsl:otherwise>no-force</xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="initial.page.number"> <xsl:param name="element" select="local-name(.)"/> <xsl:param name="master-reference" select="''"/> <xsl:variable name="first.book.content" select="ancestor::book/*[ not(self::title or self::subtitle or self::titleabbrev or self::bookinfo or self::info or self::dedication or self::preface or self::toc or self::lot)][1]"/> <xsl:choose> <xsl:when test="$double.sided != 0"> <xsl:choose> <xsl:when test="$element = 'chapter'">auto</xsl:when> <xsl:when test="$element = 'toc'">auto-odd</xsl:when> <xsl:when test="$element = 'book'">1</xsl:when> <xsl:when test="$element = 'preface'">auto-odd</xsl:when> <xsl:when test="($element = 'dedication' or $element = 'article') and not(preceding::chapter or preceding::preface or preceding::appendix or preceding::article or preceding::dedication or parent::part or parent::reference)">1</xsl:when> <xsl:when test="generate-id($first.book.content) = generate-id(.)">1</xsl:when> <xsl:otherwise>auto</xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="$element = 'toc'">auto</xsl:when> <xsl:when test="$element = 'book'">1</xsl:when> <xsl:when test="$element = 'preface'">auto</xsl:when> <xsl:when test="($element = 'dedication' or $element = 'article') and not(preceding::chapter or preceding::preface or preceding::appendix or preceding::article or preceding::dedication or parent::part or parent::reference)">1</xsl:when> <xsl:when test="generate-id($first.book.content) = generate-id(.)">1</xsl:when> <xsl:otherwise>auto</xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="user.pagemasters"> <fo:page-sequence-master master-name="body-chapter"> <fo:repeatable-page-master-alternatives> <fo:conditional-page-master-reference master-reference="blank" blank-or-not-blank="blank"/> <fo:conditional-page-master-reference master-reference="body-odd" odd-or-even="odd"/> <fo:conditional-page-master-reference odd-or-even="even"> <xsl:attribute name="master-reference"> <xsl:choose> <xsl:when test="$double.sided != 0">body-even</xsl:when> <xsl:otherwise>body-odd</xsl:otherwise> </xsl:choose> </xsl:attribute> </fo:conditional-page-master-reference> </fo:repeatable-page-master-alternatives> </fo:page-sequence-master> </xsl:template> <xsl:template name="select.user.pagemaster"> <xsl:param name="element"/> <xsl:param name="pageclass"/> <xsl:param name="default-pagemaster"/> <xsl:choose> <xsl:when test="$element = 'chapter'"> <xsl:value-of select="'body-chapter'"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$default-pagemaster"/> </xsl:otherwise> </xsl:choose> </xsl:template> Greetings, Mathias Von: Bob Stayton [mailto:] Gesendet: Mittwoch, 07. Oktober 2009 22:01 An: Mathias Schindler; DocBook Apps Betreff: Re: [docbook-apps] Don't break chapter's to recto pages Hi, I'm not clear what you mean by "half-double-sided". Can you provide a short example that illustrates the problem, and complete examples of your two customized templates? Bob Stayton Sagehill Enterprises ----- Original Message ----- From: Mathias Schindler To: DocBook Apps Sent: Monday, October 05, 2009 6:00 AM Subject: [docbook-apps] Don't break chapter's to recto pages Hi! I have a problem concerning the page breaks of <chapter> elements in double-sided PDF output! The case is that I want <part>s, <toc>, <preface>, <index> and <colophon> to break to the next recto page, while chapters and appendices should only break to the next page (regardless if recto or verso). First I tried to modify the “force.page.count”- and “initial.page.number”-templates as follows: force.page.count(only changed content):: <xsl:choose> <xsl:when test="$element != 'chapter'">auto</xsl:when> <xsl:when test="$double.sided != 0">end-on-even</xsl:when> <xsl:otherwise>no-force</xsl:otherwise> </xsl:choose> initial.page.number(only changed content): <xsl:when test="$double.sided != 0"> <xsl:choose> <xsl:when test="$element = 'chapter'">auto</xsl:when> … Unfortunately this ended up in displaying me a “half-double-sided” and “half-single-sided” document. Furthermore, not every chapter wants to wrap to a verso page… I also tried to add a custom user-pagemaster: <xsl:template name="user.pagemasters"> <fo:page-sequence-master master-name="body-chapter"> <fo:repeatable-page-master-alternatives> <fo:conditional-page-master-reference master-reference="blank" blank-or-not-blank="blank"/> <fo:conditional-page-master-reference master-reference="body-odd" odd-or-even="odd"/> <fo:conditional-page-master-reference odd-or-even="even"> <xsl:attribute name="master-reference"> <xsl:choose> <xsl:when test="$double.sided != 0">body-even</xsl:when> <xsl:otherwise>body-odd</xsl:otherwise> </xsl:choose> </xsl:attribute> </fo:conditional-page-master-reference> </fo:repeatable-page-master-alternatives> </fo:page-sequence-master> </xsl:template> <xsl:template name="select.user.pagemaster"> <xsl:param name="element"/> <xsl:param name="pageclass"/> <xsl:param name="default-pagemaster"/> <xsl:choose> <xsl:when test="$element = 'chapter'"> <xsl:value-of select="'body-chapter'"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$default-pagemaster"/> </xsl:otherwise> </xsl:choose> </xsl:template> After that it works almost perfect – almost. The double-sided output is fine but again not every chapter breaks to a verso page. I sometimes have one blank page in front of a chapter and sometimes not. Can anyone help me? Thanks in advance, Mathias Schindler
Next in thread →
Next in month →