OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] DocBook5: Issues in customization


Hi !

I'm interested in the third point too but haven't still the answer, I only can help for the second point.
I have a customization layer with a footer for titlepage page only with copyright in center and two logos at left and right,
other pages have chapter title and page number. It's a bit long because I redefined the whole template to have my footers like I wanted but maybe it can help you. I think you only need the footer.content, but just in case, i give you my whole footer customization :

  <!--###################################################
                      Custom Footers
    ################################################### -->
  <!-- FOOTER LAYOUT -->
  <xsl:template name="footer.table">
    <xsl:param name="pageclass" select="''"/>
    <xsl:param name="sequence" select="''"/>
    <xsl:param name="gentext-key" select="''"/>

    <!-- default is a single table style for all footers -->
    <!-- Customize it for different page classes or sequence location -->
    <xsl:choose>
      <xsl:when test="$pageclass = 'index'">
          <xsl:attribute name="margin-left">0pt</xsl:attribute>
      </xsl:when>
    </xsl:choose>

    <xsl:variable name="column1">
      <xsl:choose>
        <xsl:when test="$double.sided = 0">1</xsl:when>
        <xsl:when test="$sequence = 'first' or $sequence = 'odd'">1</xsl:when>
        <xsl:otherwise>3</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:variable name="column3">
      <xsl:choose>
        <xsl:when test="$double.sided = 0">3</xsl:when>
        <xsl:when test="$sequence = 'first' or $sequence = 'odd'">3</xsl:when>
        <xsl:otherwise>1</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:variable name="candidate">
      <fo:table border-collapse="separate" table-layout="fixed" width="100%">
        <xsl:call-template name="foot.sep.rule">
          <xsl:with-param name="pageclass" select="$pageclass"/>
          <xsl:with-param name="sequence" select="$sequence"/>
          <xsl:with-param name="gentext-key" select="$gentext-key"/>
        </xsl:call-template>

        <!-- sizing columns depending of footer type -->
        <xsl:choose>
          <xsl:when test="$pageclass='titlepage' and ($gentext-key='book' or $gentext-key='set')
                          and $sequence='first'">
            <fo:table-column column-number="1" column-width="35mm" />
            <fo:table-column column-number="2" column-width="*" />
            <fo:table-column column-number="3" column-width="35mm" />
          </xsl:when>
          <xsl:otherwise>
            <fo:table-column column-number="1" column-width="80mm" />
            <fo:table-column column-number="2" column-width="*" />
            <fo:table-column column-number="3" column-width="80mm" />
          </xsl:otherwise>
        </xsl:choose>

        <fo:table-body>
          <fo:table-row height="15mm">
            <fo:table-cell text-align="left">
              <xsl:choose>
                <xsl:when test="$pageclass='titlepage' and ($gentext-key='book' or $gentext-key='set')
                            and $sequence='first'">
                  <xsl:attribute name="display-align">center</xsl:attribute>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:attribute name="display-align">before</xsl:attribute>
                </xsl:otherwise>
              </xsl:choose>
              <fo:block>
                <xsl:call-template name="footer.content">
                  <xsl:with-param name="pageclass" select="$pageclass"/>
                  <xsl:with-param name="sequence" select="$sequence"/>
                  <xsl:with-param name="position" select="'left'"/>
                  <xsl:with-param name="gentext-key" select="$gentext-key"/>
                </xsl:call-template>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell text-align="center">
              <xsl:choose>
                <xsl:when test="$pageclass='titlepage' and ($gentext-key='book' or $gentext-key='set')
                            and $sequence='first'">
                  <xsl:attribute name="display-align">center</xsl:attribute>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:attribute name="display-align">before</xsl:attribute>
                </xsl:otherwise>
              </xsl:choose>
              <fo:block>
                <xsl:call-template name="footer.content">
                  <xsl:with-param name="pageclass" select="$pageclass"/>
                  <xsl:with-param name="sequence" select="$sequence"/>
                  <xsl:with-param name="position" select="'center'"/>
                  <xsl:with-param name="gentext-key" select="$gentext-key"/>
                </xsl:call-template>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell text-align="right">
              <xsl:choose>
                <xsl:when test="$pageclass='titlepage' and $gentext-key='book'
                            and $sequence='first'">
                  <xsl:attribute name="display-align">center</xsl:attribute>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:attribute name="display-align">before</xsl:attribute>
                </xsl:otherwise>
              </xsl:choose>
              <fo:block>
                <xsl:call-template name="footer.content">
                  <xsl:with-param name="pageclass" select="$pageclass"/>
                  <xsl:with-param name="sequence" select="$sequence"/>
                  <xsl:with-param name="position" select="'right'"/>
                  <xsl:with-param name="gentext-key" select="$gentext-key"/>
                </xsl:call-template>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </xsl:variable>

    <xsl:choose>
      <xsl:when test="$sequence = 'blank' and $footers.on.blank.pages = 0">
        <!-- no output -->
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy-of select="$candidate"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- FOOTER CONTENT -->
  <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="''" />

    <xsl:choose>
      <!-- footer for book and set title pages -->
      <xsl:when test="$pageclass='titlepage' and ($gentext-key='book' or $gentext-key='set')
                      and $sequence='first'">
        <xsl:choose>
          <xsl:when test="$position='left'">
              <fo:block>
                <fo:external-graphic src="../../resources/images/logo-cc.png" />
              </fo:block>
          </xsl:when>
          <xsl:when test="$position='center'">
              <fo:block font-family="Helvetica" font-size="8pt">
                <xsl:text>(CC) This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/</xsl:text>
              </fo:block>
          </xsl:when>
          <xsl:when test="$position='right'">
              <fo:block>
                <fo:external-graphic src="../../resources/images/logo-license.png" />
              </fo:block>
          </xsl:when>
        </xsl:choose>
      </xsl:when>

      <!-- footer for double-sided print -->
      <!-- first pages (right) -->
      <xsl:when test="$double.sided != 0 and $sequence = 'first' and $position='left'">
        <xsl:call-template name="division.title">
          <xsl:with-param name="node" select="ancestor-or-self::book[1]"/>
        </xsl:call-template>
      </xsl:when>
      <!--xsl:when test="$double.sided != 0 and $sequence = 'first' and $position='center'">
          first
      </xsl:when-->
      <xsl:when test="$double.sided != 0 and $sequence = 'first' and $position='right'">
        <fo:page-number/>
      </xsl:when>

      <!-- even pages (left) -->
      <xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='left'">
        <fo:page-number/>
      </xsl:when>
      <!--xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='center'">
          even
      </xsl:when-->
      <xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='right'">
        <xsl:call-template name="division.title">
          <xsl:with-param name="node" select="ancestor-or-self::book[1]"/>
        </xsl:call-template>
      </xsl:when>

      <!-- odd pages (right) -->
      <xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='left'">
        <xsl:call-template name="division.title">
          <xsl:with-param name="node" select="ancestor-or-self::book[1]"/>
        </xsl:call-template>
      </xsl:when>
      <!--xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='center'">
          odd
      </xsl:when-->
      <xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='right'">
        <fo:page-number/>
      </xsl:when>

      <!-- footer for single-sided print -->
      <xsl:when test="$double.sided = 0 and $position='right'">
        <fo:page-number/>
      </xsl:when>

       <xsl:when test="$double.sided = 0 and $position='left'">
        <xsl:call-template name="division.title">
          <xsl:with-param name="node" select="ancestor-or-self::book[1]"/>
        </xsl:call-template>
      </xsl:when>

      <xsl:when test="$sequence='blank'">
        <!-- add a footer on blank pages when double.sided to prevent gap when printing -->
        <xsl:choose>
          <xsl:when test="$double.sided != 0">
            <xsl:choose>
              <!-- even pages (left) -->
              <xsl:when test="$position='left'">
                <fo:page-number/>
              </xsl:when>
              <xsl:when test="$position='right'">
                <xsl:call-template name="division.title">
                  <xsl:with-param name="node" select="ancestor-or-self::book[1]"/>
                </xsl:call-template>
              </xsl:when>
            </xsl:choose>
          </xsl:when>
          <xsl:when test="$double.sided = 0 and $position='left'">
            <xsl:call-template name="division.title">
              <xsl:with-param name="node" select="ancestor-or-self::book[1]"/>
            </xsl:call-template>
          </xsl:when>
          <xsl:when test="$double.sided = 0 and $position = 'right'">
            <fo:page-number/>
          </xsl:when>
          <xsl:otherwise>
            <!-- nop -->
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>

      <xsl:otherwise>
        <!-- no footer -->
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>



spr a écrit :
Just started using DocBook. I am using "docbook-xsl-1.73.0" with "fop-0.93"
to convert convert a simple docbook that follows the "docbook-5.0CR5" DTD.
(Wanted to start with latest DTD to avoid migrations).

The default conversion to PDF works quite well, but I am having problems in
customizations.
I have tried the steps in
http://xml.coverpages.org/DocBook5-XSL-Stylesheets.html, but i may be
missing something very basic.
http://www.nabble.com/file/p12124271/params-test.xsl params-test.xsl 
Here are my list of issues/problems:
1) Removing the prefix "Chapter" from the chapter titles.
   (Have been able to customize style, not the content)

2) Adding a copyright label to footer text (center aligned)

3) Adding document revision number to footer text (left aligned)

Are there any quick start examples that can get me going.

I have attached my customization xsl with changes for #1 above.

Thanks,
~spr

  


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]