Page 1 of 1

XHTML to DITA transformation ignores <th> tag in table

Posted: Tue Jun 23, 2020 4:25 pm
by oxmand
Hi all,

I am trying to transform an XHTML table to DITA. The DITA output looks fine except for one thing: it omits the table header row. Here is the XHTML:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <link href="style.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
        <h2>Country Availability</h2>
        <h3>Australia</h3>
        <table>
            <tbody>
            	<tr>
                    <th>A</th>
                    <th>B</th>
                    <th>C</th>
                </tr>
                <tr>
                    <td>X</td>
                    <td>Y</td>
                    <td>Z</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>
Any idea what the issue may be?
Thanks!

Re: XHTML to DITA transformation ignores <th> tag in table

Posted: Wed Jun 24, 2020 7:44 am
by Radu
Hi,

Ideally your table would have defined the header rows in a thead element like this:

Code: Select all

<table>
            <thead>
                <tr>
                    <th>A</th>
                    <th>B</th>
                    <th>C</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>X</td>
                    <td>Y</td>
                    <td>Z</td>
                </tr>
            </tbody>
        </table>
but indeed the XHTML to DITA conversion stylesheets should not lose content even with your current approach, we'll look into fixing them.
We have a free Oxygen add-on which is more maintained than the conversion stylesheets:
https://github.com/oxygenxml/oxygen-resources-converter

The add-on should convert the HTML to DITA without losing data, but it will still not mark that first row as a header row because it was not defined inside a <thead>.

Regards,
Radu

Re: XHTML to DITA transformation ignores <th> tag in table

Posted: Wed Jun 24, 2020 11:54 am
by oxmand
Thank you very much for your reply, Radu.