docbook-apps

Re: [docbook-apps] fop: anchors generating spaces

  • 1.  Re: [docbook-apps] fop: anchors generating spaces

    Posted 06-18-2010 16:48
    I think this is an effect of FOP's handling of white spaces. In both of your
    examples, you introduce white space at the beginning of the para. In the first case,
    the white space (line feed and indent spaces) occurs after the <anchor>, and in the
    second case the white space (line feed and indent spaces) occurs before the <anchor>
    tag. In DocBook's FO output, the anchor becomes an empty <fo:inline/>, and emphasis
    also produces an fo:inline. So your FO output looks like:

    <fo:block><fo:inline/>[linebreak]
    <fo:inline>Definition 1
    ...

    <fo:block>[linebreak]
    <fo:inline/><fo:inline>Definition 2
    ...


    I'm not sure what the XSL-FO spec says about this situation, but other XSL-FO
    processors ignore leading whitespace in an fo:block. I'm pretty sure HTML browsers do
    the same in

    tags. It seems FOP does in one case but not the other. in The first
    case it treats the empty <fo:inline/> as "content" that turns on preservation of white
    space after it. In the second case, all the white space occurs before the empty
    fo:inline. You might ask the FOP mailing list about it.

    Since <para> is a mixed content element (which means it can contain both text and
    other elements), white space is considered significant in the XML. The best practice
    is to avoid leading whitespace in para, although that's often hard to do.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net