Next in thread → Next in month →

Re: [docbook-apps] Page before inside title

From
Xmplar <>
Date
2012-10-05T13:14:28+00:00
ID
Thread
Re: [docbook-apps] Page before inside title
I have a solution to customize a 'half title' page.

    

    This 'book.titlepage.before.recto' generates the book title, and
    includes a variable 'halftitle' which turns on/off the
    titlepage.before.recto:

      <xsl:template name="book.titlepage.before.recto">

        <xsl:if test="$halftitle != 0">

          <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" 

            xsl:use-attribute-sets="booktitleprops">

            <xsl:attribute name="space-before">

              <xsl:value-of select="$halftitlespacebefore"/>

            </xsl:attribute> 

            <xsl:apply-templates mode="book.titlepage.recto.mode" 

              select="d:bookinfo/d:title|d:info/d:title|d:title"/>  

          </fo:block>    

        </xsl:if>

      </xsl:template>

    

    And the verso always generates, even if there is no content (I
    specify content for this with d:cover[@role='halftitle']):

      <xsl:template name="book.titlepage.before.verso">

        <xsl:if test="$halftitle != 0">

          <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" 

            xsl:use-attribute-sets="book.titlepage.verso.style"
    break-before="page"

            break-after="odd-page">

            <xsl:apply-templates
    mode="book.titlepage.verso.auto.mode" 

              select="d:info/d:cover[@role='halftitle']"/>  

          </fo:block>      

        </xsl:if>

      </xsl:template>

    

    But I also had to modify 'book.titlepage' to get the order of
    templates and page breaks correct - the standard template generates
    content in 'book.titlepage.before.verso' after 'book.titlepage.recto',
    which is incorrect order.

    <xsl:template name="book.titlepage">

        <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">

          <!--<xsl:variable name="recto.content">

            <xsl:call-template
    name="book.titlepage.before.recto"/>

            <xsl:call-template name="book.titlepage.recto"/>

          </xsl:variable>-->

          <!--halftitle order added 5/10/12:-->

          <xsl:variable name="halftitle.content">

            <xsl:call-template
    name="book.titlepage.before.recto"/>

            <xsl:call-template
    name="book.titlepage.before.verso"/>

          </xsl:variable>

          <!--end mod-->

          <xsl:variable name="recto.elements.count">

            <xsl:choose>

              <xsl:when
    test="function-available('exsl:node-set')"><xsl:value-of
select="count(exsl:node-set($halftitle.content)/*)"/></xsl:when>

              <xsl:when test="contains(system-property('xsl:vendor'),
    'Apache Software Foundation')">

                <!--Xalan quirk--><xsl:value-of
select="count(exsl:node-set($halftitle.content)/*)"/></xsl:when>

              <xsl:otherwise>1</xsl:otherwise>

            </xsl:choose>

          </xsl:variable>

          <xsl:if test="(normalize-space($halftitle.content) != '')
    or ($recto.elements.count &gt; 0)">

            <fo:block><xsl:copy-of
    select="$halftitle.content"/></fo:block>

          </xsl:if>

          <!--<xsl:variable name="verso.content">

            <xsl:call-template
    name="book.titlepage.before.verso"/>

            <xsl:call-template name="book.titlepage.verso"/>

          </xsl:variable>-->

          <!--title order added 5/10/12:-->

          <xsl:variable name="titlepage.content">

            <xsl:call-template name="book.titlepage.recto"/>

            <fo:block break-after="page"/><!--force titlepage
    verso to start on next page ****OK 5/10/12-->

            <xsl:call-template name="book.titlepage.verso"/>

          </xsl:variable>

          <!--end mod-->

          <xsl:variable name="verso.elements.count">

            <xsl:choose>

              <xsl:when
    test="function-available('exsl:node-set')"><xsl:value-of
select="count(exsl:node-set($titlepage.content)/*)"/></xsl:when>

              <xsl:when test="contains(system-property('xsl:vendor'),
    'Apache Software Foundation')">

                <!--Xalan quirk--><xsl:value-of
select="count(exsl:node-set($titlepage.content)/*)"/></xsl:when>

              <xsl:otherwise>1</xsl:otherwise>

            </xsl:choose>

          </xsl:variable>

          <xsl:if test="(normalize-space($titlepage.content) != '')
    or ($verso.elements.count &gt; 0)">

            <fo:block><xsl:copy-of
    select="$titlepage.content"/></fo:block>

          </xsl:if>

          <xsl:call-template name="book.titlepage.separator"/>

        </fo:block>

      </xsl:template>

    

    Dave

    

    On 01-10-12 11:50 AM, Bob Stayton wrote:
    Hi Dick,
      

      Take a look at callout #12 on this page:
      

      

http://www.sagehill.net/docbookxsl/HTMLTitlePage.html#TitlePageElems
      

      

      It includes mention of of a template named t:titlepage-before
      t:side="recto", which by default generates an empty placeholder
      template named 'book.titlepage.before.recto'  that is executed
      before the recto titlepage. You could most add a customized
      'book.titlepage.before.recto' template to your customization.   If
      you want it to generate a page, you would need to wrap your
      content in a page-sequence, which can be done by calling the
      utility template "page.sequence", which is defined in
      fo/component.xsl.
      

      

      Bob Stayton
      

      Sagehill Enterprises
      

      
      

      

      --------------------------------------------------
      

      From: "Richard Hamilton" <>
      

      Sent: Wednesday, September 26, 2012 5:22 PM
      

      To: "DocBook Apps" <>
      

      Subject: [docbook-apps] Page before inside title
      

      

      Has anyone figured out how to do a page
        before the inside title in a DocBook book? This is typically a
        page that has blurbs, etc., and normally appears as the very
        first page in a book, before the inside title page.
        

        

        I can get a page after the inside title and before the TOC by
        using <dedication>, but I can't figure out how to get
        something in front of the inside title.
        

        

        Thanks,
        

        Dick Hamilton
        

        -------
        

        XML Press
        

        New from XML Press:
        

        The Content Pool
        

        http://xmlpress.net/publications/the-content-pool
        

        

        

---------------------------------------------------------------------
        

        To unsubscribe, e-mail:
        
        

        For additional commands, e-mail:
        
        

        

        

        

      
      

---------------------------------------------------------------------
      

      To unsubscribe, e-mail:
      
      

      For additional commands, e-mail:
      
Next in thread → Next in month →