docbook-apps

  • 1.  Replacing recto titlepage

    Posted 09-10-2013 09:53
    Hi all,

    I'm a beginner, I've added a image as my first page of the fo output, but i
    can't delete the recto title page which was auto generated by the *
    titlepage.templates.xsl*.

    As far as i know, the docbook1.78.1 will generate two consecutive titlepages,
    one shows the title in recto and the subtitle and copyright shows in verso.

    Refer to http://www.sagehill.net/docbookxsl/ReplaceTemplate.html
    I've been trying to replace the *titlepage.templates.xsl* by call-template
    in my *frontcover.xsl*, but i failed.

    Here is the codes in my frontcover.xsl, and part of it are definitely wrong:

    > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> <xsl:import
    > href="C:/docbook/docbook-xsl-ns-1.78.1/fo/docbook.xsl"/>
    >
    > <xsl:template name="front.cover">
    > <xsl:call-template name="page.sequence">
    > <xsl:with-param name="master-reference">front-cover</xsl:with-param>
    > <xsl:with-param name="content">
    > <fo:block alignment-adjust="auto">
    > <fo:external-graphic src="images/DB.jpg" content-width="{$page.width}"
    > content-height="{$page.height}" display-align="center"/>
    > </fo:block>
    > </xsl:with-param>
    > </xsl:call-template>
    > </xsl:template>
    >
    > <xsl:template name="user.pagemasters">
    > <fo:simple-page-master master-name="front-cover"
    > page-width="{$page.width}" page-height="{$page.height}" margin-top="0pt"
    > margin-bottom="0pt" margin-left="0pt" margin-right="0pt">
    > <fo:region-body margin-top="0pt" margin-bottom="0pt" margin-left="-0pt"
    > margin-right="0pt"/>
    > </fo:simple-page-master>
    > </xsl:template>


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


    And all i want is to delete the recto page and keep the verso one - replace
    the recto page by the image cover.

    Can anyone give me some advice?

    Thanks in advance.
    Mona Qi



  • 2.  Re: [docbook-apps] Replacing recto titlepage

    Posted 09-10-2013 14:25
    Hi.

    Are you using the book element for your content? If so, try overriding
    the book.titlepage.recto template. There should be an
    article.titlepage.recto template also, I haven't looked for it.

    <xsl:template name="book.titlepage.recto">
    [insert-your-cover-page-here]
    </xsl:template>

    I've never worked with the front.cover template before. It does have a
    tempting name but it's empty by default and I do not think it will do
    what you are hoping.

    Good luck!

    Peter

    On Tue, Sep 10, 2013 at 5:52 AM, Mona Qi <qizilan.scutech@gmail.com> wrote:
    > Hi all,
    >
    > I'm a beginner, I've added a image as my first page of the fo output, but i
    > can't delete the recto title page which was auto generated by the
    > titlepage.templates.xsl.
    >
    > As far as i know, the docbook1.78.1 will generate two consecutive
    > titlepages, one shows the title in recto and the subtitle and copyright
    > shows in verso.
    >
    > Refer to http://www.sagehill.net/docbookxsl/ReplaceTemplate.html
    > I've been trying to replace the titlepage.templates.xsl by call-template in
    > my frontcover.xsl, but i failed.
    >
    > Here is the codes in my frontcover.xsl, and part of it are definitely wrong:
    >>
    >> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    >> xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> <xsl:import
    >> href="C:/docbook/docbook-xsl-ns-1.78.1/fo/docbook.xsl"/>
    >>
    >> <xsl:template name="front.cover">
    >> <xsl:call-template name="page.sequence">
    >> <xsl:with-param name="master-reference">front-cover</xsl:with-param>
    >> <xsl:with-param name="content">
    >> <fo:block alignment-adjust="auto">
    >> <fo:external-graphic src="images/DB.jpg" content-width="{$page.width}"
    >> content-height="{$page.height}" display-align="center"/>
    >> </fo:block>
    >> </xsl:with-param>
    >> </xsl:call-template>
    >> </xsl:template>
    >>
    >> <xsl:template name="user.pagemasters">
    >> <fo:simple-page-master master-name="front-cover"
    >> page-width="{$page.width}" page-height="{$page.height}" margin-top="0pt"
    >> margin-bottom="0pt" margin-left="0pt" margin-right="0pt">
    >> <fo:region-body margin-top="0pt" margin-bottom="0pt" margin-left="-0pt"
    >> margin-right="0pt"/>
    >> </fo:simple-page-master>
    >> </xsl:template>
    >>
    >>
    >> <xsl:template name="book.titlepage.recto">
    >> <xsl:call-template name="user.pagemasters"/>
    >> </xsl:template>
    >> </xsl:stylesheet>
    >
    >
    > And all i want is to delete the recto page and keep the verso one - replace
    > the recto page by the image cover.
    >
    > Can anyone give me some advice?
    >
    > Thanks in advance.
    > Mona Qi
    >



  • 3.  Re: [docbook-apps] Replacing recto titlepage

    Posted 09-10-2013 18:54
    Hi Mona,
    Many people manually override the first page by rewriting the template named
    "book.titlepage.recto", as Peter suggests. However, the context for that
    template is already within an fo:page-sequence, using the 'titlepage'
    page-master. Since you cannot nest page-sequences, you would not be able to
    redefine the margins to zero as in your user pagemaster. Some people
    instead use an fo:block-container with absolute placement to override the
    titlepage master's margins when they want a full-page graphic, something
    like this:

    <xsl:template name="book.titlepage.recto">
    <fo:block-container absolute-position="absolute"
    width="{$page.width}"
    height="{$page.height}"
    top="-({$page.margin.top} + {$body.margin.top})"
    left="-({$page.margin.inner})">
    <fo:block containing the image element ...

    The advantage of this approach is that it retains the pagination. Turning
    off the book.titlepage.recto would like cause the verso titlepage to be
    numbered 1, I think.

    The reason your attempt did not work is that page-masters are declared
    separately in a prolog of the FO file, and then referenced by an
    fo:page-sequence when needed. The user.pagemasters template is
    automatically called in that prolog to add your new declarations, so you
    should not call it yourself in book.titlepage.recto. Once it is declared,
    referencing it as you did is all that is needed:

    <xsl:call-template name="page.sequence">
    <xsl:with-param name="master-reference">front-cover</xsl:with-param>


    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    --------------------------------------------------
    From: "Peter Desjardins" <peter.desjardins.us@gmail.com>
    Sent: Tuesday, September 10, 2013 7:25 AM
    To: "Mona Qi" <qizilan.scutech@gmail.com>
    Cc: "DocBook Apps" <docbook-apps@lists.oasis-open.org>
    Subject: Re: [docbook-apps] Replacing recto titlepage

    > Hi.
    >
    > Are you using the book element for your content? If so, try overriding
    > the book.titlepage.recto template. There should be an
    > article.titlepage.recto template also, I haven't looked for it.
    >
    > <xsl:template name="book.titlepage.recto">
    > [insert-your-cover-page-here]
    > </xsl:template>
    >
    > I've never worked with the front.cover template before. It does have a
    > tempting name but it's empty by default and I do not think it will do
    > what you are hoping.
    >
    > Good luck!
    >
    > Peter
    >
    > On Tue, Sep 10, 2013 at 5:52 AM, Mona Qi <qizilan.scutech@gmail.com>
    > wrote:
    >> Hi all,
    >>
    >> I'm a beginner, I've added a image as my first page of the fo output, but
    >> i
    >> can't delete the recto title page which was auto generated by the
    >> titlepage.templates.xsl.
    >>
    >> As far as i know, the docbook1.78.1 will generate two consecutive
    >> titlepages, one shows the title in recto and the subtitle and copyright
    >> shows in verso.
    >>
    >> Refer to http://www.sagehill.net/docbookxsl/ReplaceTemplate.html
    >> I've been trying to replace the titlepage.templates.xsl by call-template
    >> in
    >> my frontcover.xsl, but i failed.
    >>
    >> Here is the codes in my frontcover.xsl, and part of it are definitely
    >> wrong:
    >>>
    >>> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    >>> xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> <xsl:import
    >>> href="C:/docbook/docbook-xsl-ns-1.78.1/fo/docbook.xsl"/>
    >>>
    >>> <xsl:template name="front.cover">
    >>> <xsl:call-template name="page.sequence">
    >>> <xsl:with-param name="master-reference">front-cover</xsl:with-param>
    >>> <xsl:with-param name="content">
    >>> <fo:block alignment-adjust="auto">
    >>> <fo:external-graphic src="images/DB.jpg" content-width="{$page.width}"
    >>> content-height="{$page.height}" display-align="center"/>
    >>> </fo:block>
    >>> </xsl:with-param>
    >>> </xsl:call-template>
    >>> </xsl:template>
    >>>
    >>> <xsl:template name="user.pagemasters">
    >>> <fo:simple-page-master master-name="front-cover"
    >>> page-width="{$page.width}" page-height="{$page.height}" margin-top="0pt"
    >>> margin-bottom="0pt" margin-left="0pt" margin-right="0pt">
    >>> <fo:region-body margin-top="0pt" margin-bottom="0pt" margin-left="-0pt"
    >>> margin-right="0pt"/>
    >>> </fo:simple-page-master>
    >>> </xsl:template>
    >>>
    >>>
    >>> <xsl:template name="book.titlepage.recto">
    >>> <xsl:call-template name="user.pagemasters"/>
    >>> </xsl:template>
    >>> </xsl:stylesheet>
    >>
    >>
    >> And all i want is to delete the recto page and keep the verso one -
    >> replace
    >> the recto page by the image cover.
    >>
    >> Can anyone give me some advice?
    >>
    >> Thanks in advance.
    >> Mona Qi
    >>
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >
    >



  • 4.  Re: [docbook-apps] Replacing recto titlepage

    Posted 09-11-2013 03:32
    Hi, Peter and Bob,
    I modified my *book.titlepage.recto* template according to your suggestions.
    And the results is just what i need.
    Thanks a lot!

    Yours sincerely,
    Mona

    2013/9/11 Bob Stayton <bobs@sagehill.net>

    > Hi Mona,
    > Many people manually override the first page by rewriting the template
    > named "book.titlepage.recto", as Peter suggests. However, the context for
    > that template is already within an fo:page-sequence, using the 'titlepage'
    > page-master. Since you cannot nest page-sequences, you would not be able
    > to redefine the margins to zero as in your user pagemaster. Some people
    > instead use an fo:block-container with absolute placement to override the
    > titlepage master's margins when they want a full-page graphic, something
    > like this:
    >
    > <xsl:template name="book.titlepage.recto">
    > <fo:block-container absolute-position="absolute"
    > width="{$page.width}"
    > height="{$page.height}"
    > top="-({$page.margin.top} + {$body.margin.top})"
    > left="-({$page.margin.inner})"**>
    > <fo:block containing the image element ...
    >
    > The advantage of this approach is that it retains the pagination. Turning
    > off the book.titlepage.recto would like cause the verso titlepage to be
    > numbered 1, I think.
    >
    > The reason your attempt did not work is that page-masters are declared
    > separately in a prolog of the FO file, and then referenced by an
    > fo:page-sequence when needed. The user.pagemasters template is
    > automatically called in that prolog to add your new declarations, so you
    > should not call it yourself in book.titlepage.recto. Once it is declared,
    > referencing it as you did is all that is needed:
    >
    >
    > <xsl:call-template name="page.sequence">
    > <xsl:with-param name="master-reference">front-**cover</xsl:with-param>
    >
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    > ------------------------------**--------------------
    > From: "Peter Desjardins" <peter.desjardins.us@gmail.com**>
    > Sent: Tuesday, September 10, 2013 7:25 AM
    > To: "Mona Qi" <qizilan.scutech@gmail.com>
    > Cc: "DocBook Apps" <docbook-apps@lists.oasis-**open.org<docbook-apps@lists.oasis-open.org>
    > >
    > Subject: Re: [docbook-apps] Replacing recto titlepage
    >
    > Hi.
    >>
    >> Are you using the book element for your content? If so, try overriding
    >> the book.titlepage.recto template. There should be an
    >> article.titlepage.recto template also, I haven't looked for it.
    >>
    >> <xsl:template name="book.titlepage.recto">
    >> [insert-your-cover-page-here]
    >> </xsl:template>
    >>
    >> I've never worked with the front.cover template before. It does have a
    >> tempting name but it's empty by default and I do not think it will do
    >> what you are hoping.
    >>
    >> Good luck!
    >>
    >> Peter
    >>
    >> On Tue, Sep 10, 2013 at 5:52 AM, Mona Qi <qizilan.scutech@gmail.com>
    >> wrote:
    >>
    >>> Hi all,
    >>>
    >>> I'm a beginner, I've added a image as my first page of the fo output,
    >>> but i
    >>> can't delete the recto title page which was auto generated by the
    >>> titlepage.templates.xsl.
    >>>
    >>> As far as i know, the docbook1.78.1 will generate two consecutive
    >>> titlepages, one shows the title in recto and the subtitle and copyright
    >>> shows in verso.
    >>>
    >>> Refer to http://www.sagehill.net/**docbookxsl/ReplaceTemplate.**html<http://www.sagehill.net/docbookxsl/ReplaceTemplate.html>
    >>> I've been trying to replace the titlepage.templates.xsl by call-template
    >>> in
    >>> my frontcover.xsl, but i failed.
    >>>
    >>> Here is the codes in my frontcover.xsl, and part of it are definitely
    >>> wrong:
    >>>
    >>>>
    >>>> <xsl:stylesheet xmlns:xsl="http://www.w3.org/**1999/XSL/Transform<http://www.w3.org/1999/XSL/Transform>
    >>>> "
    >>>> xmlns:fo="http://www.w3.org/**1999/XSL/Format<http://www.w3.org/1999/XSL/Format>"
    >>>> version="1.0"> <xsl:import
    >>>> href="C:/docbook/docbook-xsl-**ns-1.78.1/fo/docbook.xsl"/>
    >>>>
    >>>> <xsl:template name="front.cover">
    >>>> <xsl:call-template name="page.sequence">
    >>>> <xsl:with-param name="master-reference">front-**cover</xsl:with-param>
    >>>> <xsl:with-param name="content">
    >>>> <fo:block alignment-adjust="auto">
    >>>> <fo:external-graphic src="images/DB.jpg" content-width="{$page.width}"
    >>>> content-height="{$page.height}**" display-align="center"/>
    >>>> </fo:block>
    >>>> </xsl:with-param>
    >>>> </xsl:call-template>
    >>>> </xsl:template>
    >>>>
    >>>> <xsl:template name="user.pagemasters">
    >>>> <fo:simple-page-master master-name="front-cover"
    >>>> page-width="{$page.width}" page-height="{$page.height}" margin-top="0pt"
    >>>> margin-bottom="0pt" margin-left="0pt" margin-right="0pt">
    >>>> <fo:region-body margin-top="0pt" margin-bottom="0pt" margin-left="-0pt"
    >>>> margin-right="0pt"/>
    >>>> </fo:simple-page-master>
    >>>> </xsl:template>
    >>>>
    >>>>
    >>>> <xsl:template name="book.titlepage.recto">
    >>>> <xsl:call-template name="user.pagemasters"/>
    >>>> </xsl:template>
    >>>> </xsl:stylesheet>
    >>>>
    >>>
    >>>
    >>> And all i want is to delete the recto page and keep the verso one -
    >>> replace
    >>> the recto page by the image cover.
    >>>
    >>> Can anyone give me some advice?
    >>>
    >>> Thanks in advance.
    >>> Mona Qi
    >>>
    >>>
    >> ------------------------------**------------------------------**---------
    >> To unsubscribe, e-mail: docbook-apps-unsubscribe@**lists.oasis-open.org<docbook-apps-unsubscribe@lists.oasis-open.org>
    >> For additional commands, e-mail: docbook-apps-help@lists.oasis-**open.org<docbook-apps-help@lists.oasis-open.org>
    >>
    >>
    >>
    >>


    --
    ???
    ???????
    -----------------------------------------------------------------------------------------------
    ?????????????(SCUTECH CORPORATION)
    ??:????????80?????????D?427--430??
    ??:510663
    ??:http://www.scutech.com