mardi 12 juillet 2011

Tables composed of header rows

I encountered Word documents containing tables composed only of header rows. The conversion would then lead to an error in DITA as you cannot have tables composed only of header rows in DITA.

In Dita4Publishers, a row is generated to avoid this problem. I actually prefered not having to check for the "special" row created when the problem occured :-). I decided that tables written only with header rows should be converted into a DITA table written only with "normal" rows.

In simple2dita.xsl (Dita4Publishers), in the template matching "rsiwp:table", I completed the condition generating the thead element: it should be generated if there is a rsiwp:th element (a heading row) AND if there is a rsiwp:tr element (a normal row).


But we then have to write in the body of the Dita table what is to be found in the header if there is no body row (the test in yellow).

(You'll maybe notice that I got rid of the "xsl:choose". I do not need it as the "xsl:apply-templates select="rsiwp:tr"" only has an effect if there is a row ("rsiwp:tr" element).)

Experimenting a Word to Dita to Pdf transformation with open-tools

Less than a year ago, I was made to work with DITA to try to convert Word files to Dita, and that for free, if possible... I then learned to know DITA for Publishers (http://dita4publishers.sourceforge.net/) which was the base of my experiments concerning the Word-> Dita transformation and the DITA Open Toolkit (http://dita-ot.sourceforge.net/) for the Dita-> Pdf side of the work.
I intend to publish here the modifications I made that helped me get closer to the result I wanted :-)!