Table with proportional and absolute column widths do not render properly
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 41
- Joined: Thu Jun 02, 2022 1:39 pm
Table with proportional and absolute column widths do not render properly
Post by antonyterrence »
If a DITA CALS table uses both proportional and absolute widths, the column with the absolute value appears too narrow to display content properly.
For example, if a table has the following colspecs, then the second column appears too narrow in the output (HTML).
If a table uses only the proportional values or absolute values, the table is rendered correctly (at least, column widths are distributed proportionally).
For example, if a table has the following colspecs, then the second column appears too narrow in the output (HTML).
Code: Select all
<colspec colname="c1" colnum="1" colwidth="1*"/>
<colspec colname="c2" colnum="2" colwidth="4in"/>
-
- Posts: 9421
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Table with proportional and absolute column widths do not render properly
Hi Antony,
Right, so for a DITA table like this:
I get this HTML5 equivalent when publishing:
Notice in the HTML content those:
So the 4 inches column width is propagated correctly to the HTML5 document but the first column is set to "width:100%" and this seems to make the web browser fully maximize it.
I do not have a solution for this, the HTML table spans the entire page, it does not have an explicit width set to it.
The CALS table specification states:
https://www.oasis-open.org/specs/a502.htm
Maybe the solution in the HTML content would be to do something like this:
but this does not seem to work in a web browser.
As I do not have a possible way to fix the HTML publishing I cannot add a DITA OT issue for this.
Maybe you can try to avoid using both proportional and fixed widths in tables.
Regards,
Radu
Right, so for a DITA table like this:
Code: Select all
<table id="table_ut4_xck_15b">
<tgroup cols="2">
<colspec colname="c1" colnum="1" colwidth="1*"/>
<colspec colname="c2" colnum="2" colwidth="4in"/>
<tbody>
<row>
<entry>q</entry>
<entry>b</entry>
</row>
<row>
<entry>c</entry>
<entry>d</entry>
</row>
</tbody>
</tgroup>
</table>
Code: Select all
<table class="table"
id="introduction__table_ut4_xck_15b">
<colgroup>
<col style="width:100%">
<col style="width:4in">
</colgroup><tbody class="tbody">
<tr class="row">
<td class="entry">q</td>
<td class="entry">b</td>
</tr>
<tr class="row">
<td class="entry">c</td>
<td class="entry">d</td>
</tr>
</tbody></table>
Code: Select all
<col style="width:100%">
<col style="width:4in">
I do not have a solution for this, the HTML table spans the entire page, it does not have an explicit width set to it.
The CALS table specification states:
https://www.oasis-open.org/specs/a502.htm
so it states to subtract from the table width (that the XSLT processing does not know because the table width fits the displayed page width) the fixed column widths and find out the width of the proportional columns.When any proportional parts are specified, the unit proportion is determined by starting with the target table width determined from the <table> pgwide value non-zero for full width, "0" for galley column width (possibly affected by current indents). Reduce that by sum of border widths and column ruling widths and the fixed parts of the various <colspec> colwidths to get the available proportional width.
Maybe the solution in the HTML content would be to do something like this:
Code: Select all
<colgroup>
<col style="width:calc(100% - 4in)">
<col style="width:4in">
</colgroup>
As I do not have a possible way to fix the HTML publishing I cannot add a DITA OT issue for this.
Maybe you can try to avoid using both proportional and fixed widths in tables.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Table with proportional and absolute column widths do not render properly
Post by chrispitude »
Hi Antony,
We ran into the exact same thing last week.
The browser behavior does seem to work better if you specify unallocated (blank) widths instead of proportionally allocated (#*) widths:
but with this workaround, you cannot specify relative proportions across multiple "#*".columns.
For now, I added the following Schematron rule to warn writers of mixing proportional and fixed allocations:
Lastly, PDF Chemistry handles a mix of proportional and fixed column widths in a smarter way (which differs from the browser behavior), but if you are developing both HTML-based and PDF deliverables from the same DITA source, then that becomes difficult to take advantage of.
- Chris
We ran into the exact same thing last week.
The browser behavior does seem to work better if you specify unallocated (blank) widths instead of proportionally allocated (#*) widths:
Code: Select all
<colspec colname="c1" colnum="1" colwidth=""/>
<colspec colname="c2" colnum="2" colwidth="4in"/>
For now, I added the following Schematron rule to warn writers of mixing proportional and fixed allocations:
Code: Select all
<pattern id="tables_error">
<rule context="tgroup" role="error">
<report test="colspec/@colwidth[contains(., '*')] and colspec/@colwidth[matches(., '\d') and not(contains(., '*'))]">Do not mix proportional ("*") widths with fixed widths; use blank values for automatically allocated widths.</report>
</rule>
</pattern>
- Chris
Last edited by chrispitude on Wed Jun 29, 2022 1:34 pm, edited 1 time in total.
-
- Posts: 41
- Joined: Thu Jun 02, 2022 1:39 pm
Re: Table with proportional and absolute column widths do not render properly
Post by antonyterrence »
Thank you, Chris and Radu. I have already advised the team to use one type of value consistently (in this case, proportional).
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Table with proportional and absolute column widths do not render properly
Post by chrispitude »
Hi Antony, Radu,
I noticed (while working on something else) that a writer can inadvertently cause this condition by inserting a new column in a table that currently uses fixed columns widths.
In the Oxygen editor, the newly inserted column has a proportional width value:
which causes the issue. You can see this in the following testcase by adding a new column to the table, then building the deliverables in the "project.xml" file. (This testcase also demonstrates the PDF Chemistry behavior, which is to honor the fixed column width, then still apply the full-page width to the second column.)
Perhaps the behavior of Oxygen's column insertion operation could be improved here to set @colwidth to "" (or leave it unset) when any existing column has a fixed width value. (In my Schematron check, I determine this by looking for any @colwidth value that has a digit but not a "*".) This would allow the insertion operation to match the table's existing width convention of proportional values or not.
I noticed (while working on something else) that a writer can inadvertently cause this condition by inserting a new column in a table that currently uses fixed columns widths.
In the Oxygen editor, the newly inserted column has a proportional width value:
Code: Select all
<colspec colname="c1" colnum="1" colwidth="3in" colsep="1"/>
<colspec colname="newCol2" colnum="2" colwidth="1*"/>
oxygen_adding_table_column.zip
Perhaps the behavior of Oxygen's column insertion operation could be improved here to set @colwidth to "" (or leave it unset) when any existing column has a fixed width value. (In my Schematron check, I determine this by looking for any @colwidth value that has a digit but not a "*".) This would allow the insertion operation to match the table's existing width convention of proportional values or not.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 9421
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Table with proportional and absolute column widths do not render properly
Hi Chris,
I agree, I added an internal issue to look more into this:
EXM-50841 Improve behavior when adding column or resizing column in table which has fixed column widths
I would be inclined that when the action to add a new table column is called for a table with fixed column widths, to insert that column with a fixed width.
Regards,
Radu
I agree, I added an internal issue to look more into this:
EXM-50841 Improve behavior when adding column or resizing column in table which has fixed column widths
I would be inclined that when the action to add a new table column is called for a table with fixed column widths, to insert that column with a fixed width.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9421
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Table with proportional and absolute column widths do not render properly
Hi,
As an update we fixed issue EXM-50841 in Oxygen 25, we decided that when a new column is inserted we will use the same width as the column which is located to the left of it.
Regards,
Radu
As an update we fixed issue EXM-50841 in Oxygen 25, we decided that when a new column is inserted we will use the same width as the column which is located to the left of it.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service