Search code examples
xsl-foantenna-house

How to align 2 blocks vertically using leaders


I need to use fo:leader for create a table with requests and responses like this:

Table leader like this

However the final result is like that:

Both block align top

My problem is when the left block have 2 lines and the right block have 2 lines both of them align on top. I need to align the left block on top and the right block on bottom.

Is that possible?

Follow the atual code:

<fo:inline-container vertical-align="top" inline-progression-dimension="60%">
<fo:block start-indent="0.5em" text-indent="-0.5em" text-align-last="justify" margin-right="0.3cm"<xsl:value-of select="challenge/para|limitdesc/para|sopitem/para"/>
<fo:leader leader-pattern="dots"/</fo:block>
</fo:inline-container>
<fo:inline-container relative-position="relative" vertical-align="bottom" display-align="after" inline-progression-dimension="40%">
<fo:block start-indent="0.5em" text-indent="-0.5em" display-align="after"><xsl:value-of select="response/para|limitvalue/para|limittext/para|act/para"/></fo:block>
</fo:inline-container>

Solution

  • I tried using AH Formatter and found two solutions.

    [1] Use baseline-shift for the latter fo:inline-container

    <fo:block>
        <fo:inline-container vertical-align="top" inline-progression-dimension="60%">
            <fo:block start-indent="0.5em" text-indent="-0.5em" text-align-last="justify">
                [1] Text here text here text here text here text here text here text here
                <fo:leader leader-pattern="dots"/></fo:block></fo:inline-container><fo:inline-container baseline-shift="-1.44em" inline-progression-dimension="40%">
            <fo:block start-indent="0.5em" text-indent="-0.5em" display-align="after">
                Continued text here text here text here text here
            </fo:block>
        </fo:inline-container>
    </fo:block>
    

    I specifies `baseline-shift="-1.44em". (This depends the used font) This method works only when the first line count equals 2.

    [2] Use fo:table instead of fo:inline-container

    <fo:table width="100%">
        <fo:table-column column-number="1" column-width="60%"/>
        <fo:table-column column-number="2" column-width="40%"/>
        <fo:table-body>
            <fo:table-row>
                <fo:table-cell>
                    <fo:block start-indent="0.5em" text-indent="-0.5em" text-align-last="justify">
                        [2] Text here text here text here text here text here text here text here
                        <fo:leader leader-pattern="dots"/></fo:block>
                </fo:table-cell>
                <fo:table-cell/>
            </fo:table-row>
            <fo:table-row>
                <fo:table-cell/>
                <fo:table-cell padding-before="-1.32em">
                    <fo:block start-indent="0.5em" text-indent="-0.5em" display-align="after">
                        Continued text here text here text here text here
                    </fo:block>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-body>
    </fo:table>
    

    This method does not depend the text lines in the first fo:table-cell.

    The two formatting result using AH Formatter GUI:

    Formatting result in AH Formatter GUI

    My Formatter version is 6.4. But the result will be the same.