I have a <fo:table/> with 3 columns, the table body of column 1 is number, column 2 is <fo:block><fo:inline>text</fo:inline><fo:leader/></fo:block>, column 3 is <fo:block><fo:block><fo:inline>text</fo:inline></fo:block>...<!--Repeat-->...</fo:block>. Sometimes the table cell of column 2 has a long text so it wraps to the next line, in this case I want table cell of column 3 starts at the end position of table cell of column 2.
Example:
1. short text table cell column 2 ............. table cell column 3
continue
2. loooooooooooong text table cell table cell column 3
column 2 ................................... continue
For example 2 I want it to look like this:
2. loooooooooooong text table cell
column 2 ................................... table cell column 3
continue
My code:
<xsl:template match="a">
<fo:table>
<fo:table-column column-width="5%"/>
<fo:table-column column-width="60%"/>
<fo:table-column column-width="35%"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>
<xsl:apply-templates select="." mode="numbering"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block display-align="after" text-align-last="justify">
<xsl:apply-templates select="b"/>
<fo:leader leader-pattern="dots" leader-pattern-width="1mm" leader-length.minimum="2mm" keep-with-next.within-page="always"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<xsl:for-each select="c/d">
<fo:block>
<xsl:choose>
<xsl:when test="position()=1">
<xsl:apply-templates select="."/>
</xsl:when>
<xsl:otherwise>
<fo:block keep-with-previous.within-page="always" text-align="left">
<xsl:apply-templates select="."/>
</fo:block>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</xsl:for-each>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
Thank you!
The short answer is to not use an
fo:tablebut to use anfo:blockwith a largeend-indentand a corresponding negativelast-line-end-indent(see https://www.w3.org/TR/xsl11/#last-line-end-indent).The "column 3" text then goes in an
fo:inline-containercontaining anfo:blockwith the text.If alignment is a problem, then you can reverse it and put the "column 2" text in an
fo:inline-containerand usestart-indentand negativetext-indentinstead.Sample FO markup and Antenna House Formatter GUI screenshot (with area borders shown):
XSL-FO for right-aligned column 3 as requested in comment: