docbook-apps

  • 1.  Header and footer alignment for center cell

    Posted 07-19-2021 19:40
    In double-sided xsl-fo, how can you control text-align for the center cell of the header or footer table (usually chapter or section title)?

    Using the attribute-set footer.table.properties, I can set text-align, but it doesn't distinguish between recto and verso pages. "center" centers the center cell for both recto and verso pages, which is acceptable. But some books (e.g., DocBook XSL TCG) align "end" on the recto pages and "start" on the verso pages, which I find attractive.

    I tried customizing footer.table.cell.properties, but that had no affect.

    Would I have to customize the footer.table template, or can it be done with attribute-sets?

    Get Outlook for Android<https://aka.ms/ghei36>



  • 2.  Re: [docbook-apps] Header and footer alignment for center cell

    Posted 07-19-2021 20:33
    Hi Kevin,

    If you want your footer content on the outside, then I suggest you not
    put it in the center cell, but instead put it in the left or right cell,
    depending on the page number.  That's done in the template named
    "footer.content" that you would customize to define what appears in your
    footer cells.  You can also adjust the relative column widths or make
    the center column width zero if you don't use it.  The details are
    described here:

    http://www.sagehill.net/docbookxsl/PrintHeaders.html#PrintHeadersText

    Here is what I used in my book for the footers, which put the copyright
    on the inside and page number on the outside.  I left the conditional
    clauses for $double.sided = 0 even though I never used that setting.

    <xsl:param name="footer.column.widths">10  0 1</xsl:param>

    <xsl:template name="footer.content">
      <xsl:param name="pageclass" select="''"/>
      <xsl:param name="sequence" select="''"/>
      <xsl:param name="position" select="''"/>
      <xsl:param name="gentext-key" select="''"/>

      <fo:block>

       
       
        <xsl:choose>
          <xsl:when test="$sequence='blank'">
            <xsl:choose>
              <xsl:when test="$double.sided != 0 and $position = 'left'">
                <fo:inline font-weight="bold"><fo:page-number/></fo:inline>
              </xsl:when>
              <xsl:when test="$double.sided != 0 and $position = 'right'">
                <xsl:call-template name="footer.copyright"/>
              </xsl:when>
              <xsl:when test="$double.sided = 0 and $position = 'right'">
                <fo:inline font-weight="bold"><fo:page-number/></fo:inline>
              </xsl:when>
              <xsl:when test="$double.sided = 0 and $position = 'left'">
                <xsl:call-template name="footer.copyright"/>
              </xsl:when>
              <xsl:otherwise>
               
              </xsl:otherwise>
            </xsl:choose>
          </xsl:when>

          <xsl:when test="$pageclass='titlepage'">
           
          </xsl:when>

          <xsl:when test="$double.sided != 0 and ($sequence = 'even' or
    $sequence = 'last') and $position='left'">
              <fo:inline font-weight="bold"><fo:page-number/></fo:inline>
          </xsl:when>

          <xsl:when test="$double.sided != 0 and ($sequence = 'odd' or
    $sequence = 'first') and $position='right'">
            <fo:inline font-weight="bold"><fo:page-number/></fo:inline>
          </xsl:when>

          <xsl:when test="$double.sided != 0 and ($sequence = 'even' or
    $sequence = 'last') and $position='right'">
                <xsl:call-template name="footer.copyright"/>
          </xsl:when>

          <xsl:when test="$double.sided != 0 and ($sequence = 'odd' or
    $sequence = 'first') and $position='left'">
                <xsl:call-template name="footer.copyright"/>
          </xsl:when>

          <xsl:when test="$double.sided = 0 and $position='right'">
            <fo:inline font-weight="bold"><fo:page-number/></fo:inline>
          </xsl:when>

          <xsl:when test="$double.sided = 0 and $position='left'">
                <xsl:call-template name="footer.copyright"/>
          </xsl:when>

          <xsl:otherwise>
           
          </xsl:otherwise>
        </xsl:choose>
      </fo:block>
    </xsl:template>

    <xsl:template name="footer.copyright">
      <fo:inline font-size="6pt">
        <xsl:apply-templates select="/d:book/d:info/copyright[1]"
                    mode="titlepage.mode"/>
      </fo:inline>
    </xsl:template>

    Let me know if any of this requires further explanation.

    Bob Stayton
    bobs@sagehill.net

    On 7/19/2021 12:39 PM, Kevin Dunn wrote:
    > In double-sided xsl-fo, how can you control text-align for the center
    > cell of the header or footer table (usually chapter or section title)?
    >
    > Using the attribute-set footer.table.properties, I can set text-align,
    > but it doesn't distinguish between recto and verso pages. "center"
    > centers the center cell for both recto and verso pages, which is
    > acceptable. But some books (e.g., DocBook XSL TCG) align "end" on the
    > recto pages and "start" on the verso pages, which I find attractive.
    >
    > I tried customizing footer.table.cell.properties, but that had no affect.
    >
    > Would I have to customize the footer.table template, or can it be done
    > with attribute-sets?
    >
    > Get Outlook for Android <https://aka.ms/ghei36>



  • 3.  Re: [docbook-apps] Header and footer alignment for center cell

    Posted 07-19-2021 20:50
    Hi Kevin,

    XSL-FO 1.1 has the values inside and outside for text-align, which should do the job.

    Those values are supported in renderx (xep), but I think FOP doesn’t support them. I’m not sure about Antenna House (but I’ll bet they do).

    I hope that helps.

    Best regards,
    Dick Hamilton
    -------
    XML Press
    XML for Technical Communicators
    http://xmlpress.net
    hamilton@xmlpress.net



    > On Jul 19, 2021, at 12:39, Kevin Dunn <kdunn@hsc.edu> wrote:
    >
    > In double-sided xsl-fo, how can you control text-align for the center cell of the header or footer table (usually chapter or section title)?
    >
    > Using the attribute-set footer.table.properties, I can set text-align, but it doesn't distinguish between recto and verso pages. "center" centers the center cell for both recto and verso pages, which is acceptable. But some books (e.g., DocBook XSL TCG) align "end" on the recto pages and "start" on the verso pages, which I find attractive.
    >
    > I tried customizing footer.table.cell.properties, but that had no affect.
    >
    > Would I have to customize the footer.table template, or can it be done with attribute-sets?
    >
    > Get Outlook for Android




  • 4.  Re: [docbook-apps] Header and footer alignment for center cell

    Posted 07-19-2021 23:25
    On 19/07/2021 21:49, Richard Hamilton wrote:
    > XSL-FO 1.1 has the values inside and outside for text-align, which
    > should do the job.
    >
    > Those values are supported in renderx (xep), but I think FOP doesn’t
    > support them.

    Correct:
    https://xmlgraphics.apache.org/fop/compliance.html#fo-property-text-align

    > I’m not sure about Antenna House (but I’ll bet they do).

    Correct, again:
    https://www.antenna.co.jp/AHF/help/en/ahf-fo11.html#text-align

    Also 'text-align-last' from XSL 1.1 (plus extensions for alignment of
    first lines, table cells that are aligned on a string, drop capitals,
    and other places).

    Regards,


    Tony Graham.
    --
    Senior Architect
    XML Division
    Antenna House, Inc.
    ----
    Skerries, Ireland
    tgraham@antenna.co.jp