DocBook5: Issues in customization

View: New views
6 Messages — Rating Filter:   Alert me  

DocBook5: Issues in customization

by spr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.
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
~spr

Re: DocBook5: Issues in customization

by Marie Sauvage [EBM WebSourcing] :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

  
--------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@... For additional commands, e-mail: docbook-apps-help@...

Re: DocBook5: Issues in customization

by Johnson Earls :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For item #1, check out the DocBook XSL Handbook, chapter 8, "Generated
text":

http://www.sagehill.net/docbookxsl/TitleFontSizes.html#ChapterTitles

The gentext template you're looking to customize is the "chapter"
template in the "title" context:

<xsl:param name="local.l10n.xml" select="document('')"/>
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
  <l:l10n language="en">
    <l:context name="title">
      <l:template name="chapter" text="Chapter %n. %t"/>
    </l:context>
  </l:l10n>
</l:i18n>

- dfp

--- spr <spremi@...> wrote:

>
> 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
>
> --
> View this message in context:
>
http://www.nabble.com/DocBook5%3A-Issues-in-customization-tf4260524.html#a12124271
> Sent from the docbook apps mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@...
> For additional commands, e-mail:
> docbook-apps-help@...
>
>



       
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: DocBook5: Issues in customization

by spr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is exactly what I used. But, didn't help...

See the attachment at http://www.nabble.com/file/p12124271/params-test.xsl (not sure why it doesn;t show up properly in my earlier post).

Johnson Earls wrote:
For item #1, check out the DocBook XSL Handbook, chapter 8, "Generated
text":

http://www.sagehill.net/docbookxsl/TitleFontSizes.html#ChapterTitles

The gentext template you're looking to customize is the "chapter"
template in the "title" context:

<xsl:param name="local.l10n.xml" select="document('')"/>
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
  <l:l10n language="en">
    <l:context name="title">
      <l:template name="chapter" text="Chapter %n. %t"/>
    </l:context>
  </l:l10n>
</l:i18n>

- dfp

--- spr <spremi@yahoo.com> wrote:

>
> 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
>
> --
> View this message in context:
>
http://www.nabble.com/DocBook5%3A-Issues-in-customization-tf4260524.html#a12124271
> Sent from the docbook apps mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail:
> docbook-apps-help@lists.oasis-open.org
>
>



       
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
~spr

Re: DocBook5: Issues in customization

by spr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks. Will try it tonight...
~spr

Marie Sauvage - EBM WebSourcing wrote:
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 :
~spr

Re: DocBook5: Issues in customization

by Johnson Earls :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try adding the namespace definition into the i18n element:
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">

- dfp

--- spr <spremi@...> wrote:

>
> This is exactly what I used. But, didn't help...
>
> See the attachment at
> http://www.nabble.com/file/p12124271/params-test.xsl
> (not sure why it doesn;t show up properly in my earlier post).
>
>
> Johnson Earls wrote:
> >
> > For item #1, check out the DocBook XSL Handbook, chapter 8,
> "Generated
> > text":
> >
> >
> http://www.sagehill.net/docbookxsl/TitleFontSizes.html#ChapterTitles
> >
> > The gentext template you're looking to customize is the "chapter"
> > template in the "title" context:
> >
> > <xsl:param name="local.l10n.xml" select="document('')"/>
> > <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
> >   <l:l10n language="en">
> >     <l:context name="title">
> >       <l:template name="chapter" text="Chapter %n. %t"/>
> >     </l:context>
> >   </l:l10n>
> > </l:i18n>
> >
> > - dfp
> >
> > --- spr <spremi@...> wrote:
> >
> >>
> >> 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
> >>
> >> --
> >> View this message in context:
> >>
> >
>
http://www.nabble.com/DocBook5%3A-Issues-in-customization-tf4260524.html#a12124271

> >> Sent from the docbook apps mailing list archive at Nabble.com.
> >>
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> docbook-apps-unsubscribe@...
> >> For additional commands, e-mail:
> >> docbook-apps-help@...
> >>
> >>
> >
> >
> >
> >        
> >
>
____________________________________________________________________________________

> > Be a better Heartthrob. Get better relationship answers from
> someone who
> > knows. Yahoo! Answers - Check it out.
> > http://answers.yahoo.com/dir/?link=list&sid=396545433
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> docbook-apps-unsubscribe@...
> > For additional commands, e-mail:
> docbook-apps-help@...
> >
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/DocBook5%3A-Issues-in-customization-tf4260524.html#a12127593
> Sent from the docbook apps mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@...
> For additional commands, e-mail:
> docbook-apps-help@...
>
>



       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...