docbook-apps

  • 1.  FOP and dbfo-need

    Posted 10-04-2013 16:17
    Hi!

    I'm having some trouble with the processing
    instruction. I use DocBook 4.5 with nothing fancy in the stylesheet and
    I use FOP-1.1 to generate the PDF.

    I have a <variablelist> that spans several pages, some entries are big, some
    are small. So, I want to declare how much space some <varlistentry>s need,
    in order to make it all not look insanely silly.

    The "Soft page breaks" section in chapter 8 of the DocBook XSL guide [1]
    hints that I should put the PI inside the <listitem>, but that simply does
    not work for me (the content of the <listitem> disappears).

    So, I tried to break up the <variablelist> everywhere I need to declare
    how much space is needed (by also explicitly specifying the termlength
    for each list part, to make them line up). This works, but if the page
    break then moves, the broken up <variablelist> inserts a different
    amount of space between the last <varlistentriy> of the prior list
    and the first entry of the next list. Not very surprising really, but
    it is surprising that the vertical space is equal if this PI is not
    there. I would have thought that the whole point of this PI was that
    it should disappear into thin air if not "invoked" near the end of a
    page?

    I.e.
    <variablelist>
    <varlistentry>...</varlistentry>

    <varlistentry>...</varlistentry>
    </variablelist>

    <variablelist>
    <varlistentry>...</varlistentry>
    </variablelist>


    <variablelist>
    <varlistentry>...</varlistentry>
    </variablelist>

    So, while I can make it look good once, it will be a nightmare to
    maintain. I basically have to manually page break the document for
    every change I make and differently so for every page size I may
    decide to render to.

    Can anyone offer any advise?

    Cheers,
    Peter

    [1] http://www.sagehill.net/docbookxsl/index.html



  • 2.  Re: [docbook-apps] FOP and dbfo-need

    Posted 10-04-2013 18:04
    Hi Peter,
    I'm afraid that the dbfo-need processing instruction still does not always
    work properly in FOP 1.1. It sort of works in some cases, such as between
    paras or whole lists, but not in other cases.

    The PI works by inserting a fo:block-container of the specified height, then
    backing up using a block with a negative space-before of the same height,
    and then overwriting the invisible block-container with the text that
    follows the PI. If the block-container triggers a page break, then it backs
    up to the top of the next page, as it should. The PI is also supposed to
    "disappear" space-wise if it does not trigger a page break.

    The main problem is that FOP has not fully implemented space-before (see the
    space-before entry on the FOP standards compliance page, which says "Space
    adjustment may not fully work everywhere, yet."
    (http://xmlgraphics.apache.org/fop/compliance.html). As you found, putting
    the PI between lists works to break the page, but it doesn't adjust the
    vertical spacing properly if it doesn't break. In the case of the PI inside
    a variablelist/listitem, FOP outputs the term, breaks the page, and the
    listitem disappears. In other FO processors like XEP or Antenna House, the
    term and listitem stay together and bump to the next page as they should.

    Because of these problems, the stylesheet by default disables the dbfo-need
    PI when the stylesheet param 'fop1.extensions' is set to 1. That param
    should be set when using FOP 1.1. If the PI is having any effect at all,
    then you must not be setting that param. If that's the case, then you
    probably aren't getting PDF bookmarks either.

    Not all is lost, however. The keep-together processing instruction works in
    FOP, so you can add it to each varlistentry as follows:

    <varlistentry>
    <term>...

    That will at least prevent each varlistentry from breaking across a page.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    --------------------------------------------------
    From: "Peter Rosin" <peda@lysator.liu.se>
    Sent: Friday, October 04, 2013 9:16 AM
    To: <docbook-apps@lists.oasis-open.org>
    Subject: [docbook-apps] FOP and dbfo-need

    > Hi!
    >
    > I'm having some trouble with the processing
    > instruction. I use DocBook 4.5 with nothing fancy in the stylesheet and
    > I use FOP-1.1 to generate the PDF.
    >
    > I have a <variablelist> that spans several pages, some entries are big,
    > some
    > are small. So, I want to declare how much space some <varlistentry>s need,
    > in order to make it all not look insanely silly.
    >
    > The "Soft page breaks" section in chapter 8 of the DocBook XSL guide [1]
    > hints that I should put the PI inside the <listitem>, but that simply does
    > not work for me (the content of the <listitem> disappears).
    >
    > So, I tried to break up the <variablelist> everywhere I need to declare
    > how much space is needed (by also explicitly specifying the termlength
    > for each list part, to make them line up). This works, but if the page
    > break then moves, the broken up <variablelist> inserts a different
    > amount of space between the last <varlistentriy> of the prior list
    > and the first entry of the next list. Not very surprising really, but
    > it is surprising that the vertical space is equal if this PI is not
    > there. I would have thought that the whole point of this PI was that
    > it should disappear into thin air if not "invoked" near the end of a
    > page?
    >
    > I.e.
    > <variablelist>
    > <varlistentry>...</varlistentry>
    >
    > <varlistentry>...</varlistentry>
    > </variablelist>
    >
    > <variablelist>
    > <varlistentry>...</varlistentry>
    > </variablelist>
    >
    >
    > <variablelist>
    > <varlistentry>...</varlistentry>
    > </variablelist>
    >
    > So, while I can make it look good once, it will be a nightmare to
    > maintain. I basically have to manually page break the document for
    > every change I make and differently so for every page size I may
    > decide to render to.
    >
    > Can anyone offer any advise?
    >
    > Cheers,
    > Peter
    >
    > [1] http://www.sagehill.net/docbookxsl/index.html
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >
    >



  • 3.  Re: [docbook-apps] FOP and dbfo-need

    Posted 10-04-2013 21:50
    Hi Bob!

    Thank you! I can live with dbfo keep-together even if dbfo-need would
    have been a better fit for some of the larger entries.

    Cheers,
    Peter

    On 2013-10-04 20:04, Bob Stayton wrote:
    > Hi Peter,
    > I'm afraid that the dbfo-need processing instruction still does not
    > always work properly in FOP 1.1. It sort of works in some cases, such
    > as between paras or whole lists, but not in other cases.
    >
    > The PI works by inserting a fo:block-container of the specified
    > height, then backing up using a block with a negative space-before of
    > the same height, and then overwriting the invisible block-container
    > with the text that follows the PI. If the block-container triggers a
    > page break, then it backs up to the top of the next page, as it
    > should. The PI is also supposed to "disappear" space-wise if it does
    > not trigger a page break.
    >
    > The main problem is that FOP has not fully implemented space-before
    > (see the space-before entry on the FOP standards compliance page,
    > which says "Space adjustment may not fully work everywhere, yet."
    > (http://xmlgraphics.apache.org/fop/compliance.html). As you found,
    > putting the PI between lists works to break the page, but it doesn't
    > adjust the vertical spacing properly if it doesn't break. In the case
    > of the PI inside a variablelist/listitem, FOP outputs the term,
    > breaks the page, and the listitem disappears. In other FO processors
    > like XEP or Antenna House, the term and listitem stay together and
    > bump to the next page as they should.
    >
    > Because of these problems, the stylesheet by default disables the
    > dbfo-need PI when the stylesheet param 'fop1.extensions' is set to 1.
    > That param should be set when using FOP 1.1. If the PI is having any
    > effect at all, then you must not be setting that param. If that's the
    > case, then you probably aren't getting PDF bookmarks either.
    >
    > Not all is lost, however. The keep-together processing instruction
    > works in FOP, so you can add it to each varlistentry as follows:
    >
    > <varlistentry>
    > <term>...
    >
    > That will at least prevent each varlistentry from breaking across a page.
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    > --------------------------------------------------
    > From: "Peter Rosin" <peda@lysator.liu.se>
    > Sent: Friday, October 04, 2013 9:16 AM
    > To: <docbook-apps@lists.oasis-open.org>
    > Subject: [docbook-apps] FOP and dbfo-need
    >
    >> Hi!
    >>
    >> I'm having some trouble with the processing
    >> instruction. I use DocBook 4.5 with nothing fancy in the stylesheet and
    >> I use FOP-1.1 to generate the PDF.
    >>
    >> I have a <variablelist> that spans several pages, some entries are big, some
    >> are small. So, I want to declare how much space some <varlistentry>s need,
    >> in order to make it all not look insanely silly.
    >>
    >> The "Soft page breaks" section in chapter 8 of the DocBook XSL guide [1]
    >> hints that I should put the PI inside the <listitem>, but that simply does
    >> not work for me (the content of the <listitem> disappears).
    >>
    >> So, I tried to break up the <variablelist> everywhere I need to declare
    >> how much space is needed (by also explicitly specifying the termlength
    >> for each list part, to make them line up). This works, but if the page
    >> break then moves, the broken up <variablelist> inserts a different
    >> amount of space between the last <varlistentriy> of the prior list
    >> and the first entry of the next list. Not very surprising really, but
    >> it is surprising that the vertical space is equal if this PI is not
    >> there. I would have thought that the whole point of this PI was that
    >> it should disappear into thin air if not "invoked" near the end of a
    >> page?
    >>
    >> I.e.
    >> <variablelist>
    >> <varlistentry>...</varlistentry>
    >>
    >> <varlistentry>...</varlistentry>
    >> </variablelist>
    >>
    >> <variablelist>
    >> <varlistentry>...</varlistentry>
    >> </variablelist>
    >>
    >>
    >> <variablelist>
    >> <varlistentry>...</varlistentry>
    >> </variablelist>
    >>
    >> So, while I can make it look good once, it will be a nightmare to
    >> maintain. I basically have to manually page break the document for
    >> every change I make and differently so for every page size I may
    >> decide to render to.
    >>
    >> Can anyone offer any advise?
    >>
    >> Cheers,
    >> Peter
    >>
    >> [1] http://www.sagehill.net/docbookxsl/index.html