Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSL:FO avoid Space between Table Cells

Hello guy I have two table Cells and a <fo:leader/> in both Cells. How can i avoid to get a space between the two Cells. It's not possible to span the two cells.

enter image description here

I use Antennahouse and XSLT 2.0 .

Here is my Code for the table

 <fo:table width="100%"  >
           <fo:table-column column-width="50%"/>
           <fo:table-column column-width="50%"/>
            <fo:table-body  >
              <fo:table-row>
                 <fo:table-cell  >
                   <fo:block border-right-width="0.0mm" >
                      <xsl:if test="page">
                        <xsl:attribute name="text-align-last">justify</xsl:attribute>
                      </xsl:if>
                     <xsl:value-of select="concat(@ref1,' ')"/>  
                      <xsl:if test="page">                       
                          <fo:leader leader-pattern="dots"/>
                      </xsl:if>          
                   </fo:block>
                 </fo:table-cell>
                 <fo:table-cell >
                   <fo:block  text-align="justify" text-align-last="right" axf:text-align-first="justify">  
                     <xsl:if test="page">
                        <fo:leader leader-pattern="dots"  />
                     </xsl:if>   
                     <fo:inline><xsl:apply-templates select="page" mode="normal"><xsl:with-param name="chapter" select="@chapterNumber"></xsl:with-param></xsl:apply-templates></fo:inline></fo:block>
                 </fo:table-cell>
               </fo:table-row>
like image 694
Elrond Avatar asked Jul 28 '26 11:07

Elrond


2 Answers

Without all the other stuff you have, with pure XSL FO and no extensions this works for me:

                <fo:table width="100%"  >
                    <fo:table-column column-width="50%"/>
                    <fo:table-column column-width="50%"/>
                    <fo:table-body  >
                        <fo:table-row>
                            <fo:table-cell>
                                <fo:block text-align-last="justify">     
                                    <fo:inline>Stuff</fo:inline>
                                        <fo:leader leader-pattern="dots"/>         
                                </fo:block>
                            </fo:table-cell>
                            <fo:table-cell>
                                <fo:block text-align-last="justify"> 
                                        <fo:leader leader-pattern="dots"  />
                                    <fo:inline>1</fo:inline></fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                    </fo:table-body>
                </fo:table>

No spaces.

enter image description here

In response to the question, is it possible I got lucky? Tested again, various content and table column widths. Content that I am showing likely is kerned and of various lengths and I varied the size of the table cells. In all cases there is no gap.

enter image description here

I tested a few others things and realize the difference is the formatter. Apache FOP and Antennahouse yield the issue you have shown, I was using RenderX XEP (whom I work for). It does not exhibit this behavior. IMHO, the correct answer is no spaces if your formatter has the algorithms for allowing inter-character and word space squeezing to fit within an allowable tolerance. Justified is "justified".

like image 131
Kevin Brown Avatar answered Jul 30 '26 08:07

Kevin Brown


I think there are two reasons for the strange "gap" between the two series of dots on each table row:

  1. the column is not an exact multiple of the leader pattern (dot + space); for example, supposing a dot and a space are 3 mm wide and the empty area to be filled by the fo:leader has a width of 17 mm, the formatter can only insert 5 dots, leaving an extra gap of 2 mm
  2. the dots on different rows are not aligned; each series of dots in the left column starts rigth from the end of the preceding text, so the gap depends also on the text length

Solution:

  • use leader-alignment="reference-area" (which XSLFormatter supports)
  • set a leader-pattern-width, and set the table width to a multiple of that
like image 26
lfurini Avatar answered Jul 30 '26 08:07

lfurini