Table border is partially missing after page break
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 455
- Forks
- 211
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 3
Description
Expected Behavior
The table border should be drawn correctly for all table cells.
Actual Behavior
When a table is split by a page break and the last row on the previous page contains less cells due to column spanning (using namest and nameend), the top border is partially missing on the first row of the next page.
Possible Solution
The issue appears from the following code - https://github.com/dita-ot/dita-ot/blob/develop/src/main/plugins/org.dita.pdf2/xsl/fo/tables.xsl#L698-L711
Say we have 1 cell in the row on the previous page and 2 cells in the row on the following page. Then entryNum will be 2 for the second cell but it will not find the second cell in the previous row. Hence, prevEntryRowsep will be '0'.
Possible (not ideal) solution is to use min(($entryNum, last())) to pick the last cell if we cannot find the cell by number:
<xsl:variable name="prevEntryRowsep" as="xs:string?">
<xsl:for-each select="../preceding-sibling::*[contains(@class, ' topic/row ')][1]/*[contains(@class, ' topic/entry ')][min(($entryNum, last()))]">
<xsl:call-template name="getTableRowsep"/>
</xsl:for-each>
</xsl:variable>
However, this code will work incorrectly if we have different column spanning in both rows and finding a cell by number might return the wrong cell. For example, if table contains more than 2 columns and in the first row columns are spanned in the beginning but in the second row columns are spanned in the end, we will need to actually take spanning into account to find the right cell. Quite tricky. The above code works for me though but probably does not fit into the public codebase.
Steps to Reproduce
Here is an example of a table - with a message clarifying where the page break should be:
<table>
<tgroup cols="2">
<colspec colname="left" colwidth="50*"/>
<colspec colname="right" colwidth="50*"/>
<tbody>
<row>
<entry namest="left" nameend="right" align="center">
<p>Spanned cells content</p>
</entry>
</row>
... here should be the page break ...
<row>
<entry align="center">
<p>First cell</p>
</entry>
<entry align="center">
<p>Second cell with missing top border</p>
</entry>
</row>
</tbody>
</tgroup>
</table>
Environment
- DITA-OT version: I use 2.5.4 but the code is the same in develop branch so should be reproducible in all versions
- Operating system and version: macOS
- How did you run DITA-OT?
ditacommand - Transformation type: PDF
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/main/plugins/org.dita.pdf2/xsl/fo/tables.xsl around lines 698-711 and reproduce the issue with the provided spanning-table example using the dita command and PDF transformation. Trace how the previous row's entry is selected across a page break, then verify that the top border is drawn for every cell when column spanning differs between rows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- xml
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100