Page 1 of 1

Column headings for subcolumns

Posted: Tue Oct 08, 2019 6:08 am
by jmorales
Hi, I have a table with two columns, and in the second column, one of the cells is subdivided into three columns and three rows. Or rather, that's how it looks in Author mode, but in Text mode you can see that the whole table is actually coded as four columns, and in most of the rows, the right three cells are merged. (I'll paste in the code for the table at the end of this message.) How can I indicate that the first entry in each sub column is a column heading, so our css will be able to apply a bold style? The cells that need to be treated as column headings are the ones below with the contents UTC Offset, Time Zone, and Hours Offset. I considered setting a @class attribute for the entry element, but it seems this may be a semantically incorrect use of the @class attribute. Thanks for any suggestions.

Code: Select all

        <table rowheader="firstcol" id="table_jdg_1lb_3jb">
            <tgroup cols="4">
                <colspec colname="c1" colnum="1" colwidth="1*"/>
                <colspec colname="c2" colnum="2" colwidth="1*"/>
                <colspec colname="c3" colnum="3" colwidth="1*"/>
                <colspec colname="c4" colnum="4" colwidth="1*"/>
                <thead>
                    <row>
                        <entry>Question</entry>
                        <entry outputclass="colspan_3" namest="c2" nameend="c4">Answer</entry>
                    </row>
                </thead>
                <tbody>
                    <row>
                        <entry>What is xyz?</entry>
                        <entry outputclass="colspan_3" namest="c2" nameend="c4">Here are the
                            contents of a cell that is not subdivided into columns.</entry>
                    </row>
                    <row>
                        <entry morerows="4">Why is xyz?</entry>
                        <entry outputclass="colspan_3" namest="c2" nameend="c4">This is an
                            introductory sentence.</entry>
                    </row>
                    <row>
                        <entry>UTC Offset</entry>
                        <entry>Time Zone</entry>
                        <entry>Hours Offset</entry>
                    </row>
                    <row>
                        <entry>-18000</entry>
                        <entry>Eastern Standard Time</entry>
                        <entry>-5 hours</entry>
                    </row>
                    <row>
                        <entry>-14400</entry>
                        <entry>Eastern Daylight Time</entry>
                        <entry>-4 hours</entry>
                    </row>
                    <row>
                        <entry outputclass="colspan_3" namest="c2" nameend="c4"> Number of seconds
                            in an hour = 3600</entry>
                    </row>
                </tbody>
            </tgroup>
        </table>

Re: Column headings for subcolumns

Posted: Tue Oct 08, 2019 8:27 am
by Radu
Hi,

You already seem to be signalling this correctly using the "rowheader="firstcol"" attribute on the table element. What version of Oxygen are you using and do you want the bold text for the HTML-based or for the PDF output? If you want this for the PDF output, are you using the PDF output based on HTML and CSS or the classic PDF output based on XSL-FO?

Regards,
Radu

Re: Column headings for subcolumns

Posted: Wed Oct 09, 2019 7:45 pm
by jmorales
Thanks, Radu. I'm using Oxygen XML Author 21.1 and we output using PDF based on HTML and CSS.

One of my fellow writers just suggested using the @scope attribute. I can set the @scope to "col" for cells that need to be treated as headers, but are not in the first row of the table. For example,

<row>
<entry scope='col'>UTC Offset</entry>
<entry scope='col'>Time Zone</entry>
<entry scope='col'>Hours Offset</entry>
</row>

Then apparently the CSS can have an entry like
*[class='topic/entry'][scope='col'] {
font-weight: bold;
}

So I'll use this technique unless you can suggest something different.

Re: Column headings for subcolumns

Posted: Thu Oct 10, 2019 1:46 pm
by Radu
Hi,

You can alse use the DITA @outputclass attribute for that purpose, it should be converted to a @class attribute value in the intermediary HTML document over which the CSS is applied.
So the CSS selector would be something like:

Code: Select all

.col {
font-weight: bold;
}
Regards,
Radu

Re: Column headings for subcolumns

Posted: Thu Oct 10, 2019 9:28 pm
by jmorales
Thanks, Radu!