1

I hope you all had some Happy Holidays so far!

I'm currently working on a XSLT Transformation from DocBook to apache fo (and then onward to PDF) but I'm struggling with one table.

Here is the relevant part of my stylesheet.

<fo:block>
  <fo:table border-style="none" border-width="0pt">    
    <fo:table-column column-width="20%"/>
    <fo:table-column column-width="80%"/>                  
     <fo:table-body>                                               
       <fo:table-row>                                             
         <fo:table-cell border-style="solid" border-width="1pt" text-align="start" padding-left="0cm"> 
           <fo:block font-weight="bold">First Column <xsl:text> </xsl:text> <xsl:number level="multiple" count="d:appnote" format="1"/>
            </fo:block>                         
         </fo:table-cell>                         
         <fo:table-cell  border-style="solid" border-width="1pt" text-align="start"> 
           <fo:block><xsl:value-of select="d:description" /></fo:block>
         </fo:table-cell>                        
      </fo:table-row>
    </fo:table-body>
  </fo:table>
</fo:block>

Unfortunately, the resulting table shows some pretty big margins between the left border of the table and the beginning of the text (even though I set padding-left="0cm")

enter image description here

I tried a dozen of different attributes and options but I cannot get rid of this whitespace.
Does anybody have a tip for me?

zx485
  • 28,498
  • 28
  • 50
  • 59
Norbert
  • 735
  • 8
  • 19
  • Consider to post minimal but complete samples to allow others to reproduce the problem. I have tried to simply test the PDF generation based on the XSL-FO snippet you have shown at http://xsltfiddle.liberty-development.net/bFukv8a and the text starts at the left border of each column. – Martin Honnen Dec 28 '17 at 13:38
  • That already helps a lot! I will try to add a working minimal example later but it tells me that I don't have to look for the problem in the XSLT. Maybe it's an issue with my apache fop.... – Norbert Dec 28 '17 at 14:06
  • It is probable that the content of the table cells is inheriting a `start-indent` set on an ancestor element (even a very remote one); if this is the case, you could add a `start-indent="0pt"` attribute on the `table-body` to "reset" it to 0. – lfurini Dec 28 '17 at 19:50
  • @Ifurini: Thanks! That worked out well! – Norbert Dec 28 '17 at 23:00
  • 1
    @lfurini: Can you put that into an answer so that this question is referable to as duplicate in the future. – zx485 Dec 29 '17 at 23:22

1 Answers1

3

The start-indent property is inherited by the descendant FO elements of the one where it is set, which sometimes leads to some counter-intuitive results.

As apparently not all implementations behave in the same way, FOP's site has a specific FAQ entry: When I use margins, my content in a nested table or block-containers gets indented twice. Is this a bug?


So, in your situation it is probable that the content of the table cells is inheriting a start-indent set on an ancestor element (even a very remote one).

If this is the case, you could add a start-indent="0pt" attribute on the fo:table-body to "reset" it to 0.

lfurini
  • 3,729
  • 4
  • 30
  • 48