CALS Table colspec and PrinceXML

Post here questions and problems related to editing and publishing DITA content.
donlammers
Posts: 4
Joined: Wed Nov 09, 2016 11:52 pm

CALS Table colspec and PrinceXML

Post by donlammers »

Although colspec is editable (and seems to work if you believe the display), none of the values seem to be respected by the com.oxygenxml.pdf.css plugin (or possibly by PrinceXML itself). I can, for instance, set the text alignment on the whole table, or set alignment on individual cells, but setting the alignment in the colspec has no effect on the PDF output. colwidth as set in the colspec element also does not seem to have any effect, nor do cosep and rowsep. Is this a known limitation? We have one set of tables that the default does not get right, and have currently resorted to putting a paragraph full of non-breaking spaces in a row that was being rendered way too narrow.
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: CALS Table colspec and PrinceXML

Post by Radu »

Hi,

I think we fixed at least part of these problems in Oxygen 18.1. We also updated the GitHub repository with the fixes.
Could you tell me what Oxygen version you are using?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
donlammers
Posts: 4
Joined: Wed Nov 09, 2016 11:52 pm

Re: CALS Table colspec and PrinceXML

Post by donlammers »

I am on Editor version 18.1, build 2016.1026.19. I believe that everyone else has now updated to version 18.1 -- some on Author and some on Editor, but I can't speak for build numbers.
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: CALS Table colspec and PrinceXML

Post by Dan »

Hello,
Here are some details and workarounds:

About the column width:
Since 18.1 oXygen converts the DITA colspec @colwidth attribute to a @style attribute. For example:

Code: Select all

colwidth = 0.3* -> style = 'width:33%'
colwidth = 20 -> style = 'width:20'
This width property is interpreted by Prince, so it should alter the column widths. I tested it and it works for tables like:

Code: Select all


<table
frame="all" id="table_uyw_mlm_1y" >
<title>My test table</title>
<tgroup cols="2">
<colspec colname="c1" colnum="1" colwidth="0.3*" />
<colspec colname="c2" colnum="2" colwidth="1.0*"/>
<thead>
<row>
<entry>Header1</entry>
<entry>Header2</entry>
</row>
</thead>
<tbody >
<row>
<entry>1</entry>
<entry>2</entry>
</row>
<row>
<entry>3</entry>
<entry>4</entry>
</row>
</tbody>
</tgroup>
</table>
About the text align:
I tried converting also the colspec @align attribute to a value in the @style attribute:

Code: Select all

align = right -> style = 'text-align: right'
but Prince does not apply this property to the table cells from that column.

I recommend setting the @align attribute on the "entry" elements from the table.


About the @rowsep and @colsep
There is no CSS counterpart of these attributes set on colspec.
I recomend to move those attributes to the "entry" elements from the table, then write a CSS to style the entries based on these attributes and add it to the transformation scenario, as "args.css" parameter.
A very simple CSS for that could be:

Code: Select all

     /*
* Deal with @rowsep and @colsep.
*
* These attributes can be set on "table", "tgroup", "row", and
* "entry" elements. The "tbody" does not have such attributes.
*
* The values are inherited from the parents. The last row does
* not have a row separator, and the cells from the last column do
* not have column separators.
*/
*[class~="topic/table"][rowsep = '1'] > *[class~="topic/tgroup"]:not([rowsep]) > *[class~="topic/tbody"] > *[class~="topic/row"]:not([rowsep]):not(:last-child) > *[class~="topic/entry"]:not([rowsep]),
*[class~="topic/tgroup"][rowsep = '1'] > *[class~="topic/tbody"] > *[class~="topic/row"]:not([rowsep]):not(:last-child) > *[class~="topic/entry"]:not([rowsep]),
*[class~="topic/row"][rowsep = '1']:not(:last-child) > *[class~="topic/entry"]:not([rowsep]),
*[class~="topic/row"]:not(:last-child) > *[class~="topic/entry"][rowsep = '1']{
border-bottom:1pt solid black;
}

*[class~="topic/table"][colsep = '1'] > *[class~="topic/tgroup"]:not([colsep]) > *[class~="topic/tbody"] > *[class~="topic/row"]:not([colsep]) > *[class~="topic/entry"]:not([colsep]):not(:last-child),
*[class~="topic/tgroup"][colsep = '1'] > *[class~="topic/tbody"] > *[class~="topic/row"]:not([colsep]) > *[class~="topic/entry"]:not([colsep]):not(:last-child),
*[class~="topic/row"][colsep = '1'] > *[class~="topic/entry"]:not([colsep]):not(:last-child),
*[class~="topic/entry"][colsep = '1']:not(:last-child){
border-right:1pt solid black;
}
This CSS will be included in the next oXygen release (19).
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: CALS Table colspec and PrinceXML

Post by Dan »

Another approach is to set an @outputclass attribute on your table, then match it and style it from the CSS. This works specially if you have all entries from a column styled the same. For example to add row separators for the first column (I use element names, not DITA classes values for simplicity):

Code: Select all


table[outputclass='myOutputClass'] row > entry:nth-child(1) {
border-bottom:1px solid red;
}

table[outputclass='myOutputClass'] row:last-child > entry:nth-child(1) {
border-bottom:none;
}
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: CALS Table colspec and PrinceXML

Post by Radu »

Hi,

Just to update this thread, we released Oxygen 19.0 and Dan's fixes should be bundled with it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply