Menu

#1348 Neither role nor tabstyle set the class of a table

output: HTML
pending-fixed
5
2015-07-31
2014-11-12
Murray Lang
No

Hi,

I need to set the class of a table in html, but neither of the methods I can find that are supposed to achieve this works for me.

Using the role attribute on a table element in a DocBook xml file has no effect on the html file.

Using the tabstyle attribute on a table element in a DocBook xml file causes the div element surrounding the table in the html file to have the given class. I can't use this because I want to style the table, not the whole div.

I saw https://sourceforge.net/p/docbook/bugs/1151/ but using the latest snapshot hasn't helped.

Here is a minimal DocBook to illustrate the problem (sorry about lack of indents):

<?xml version="1.0" encoding="UTF-8"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en"
xml:id="TestTable">
<sect1>
<table tabstyle="zipclass" role="ziprole" frame='all'><title>My Table</title>
<tgroup cols='1'>
<tbody>
<row>
<entry>Zip</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
</article>

...and here is the relevant snippet of the resulting html:

<div class="zipclass">
<a name="N4000B"></a>
<p class="title">
<b>Table&nbsp;1.&nbsp;My Table</b>
</p>
<div class="zipclass-contents">
<table summary="My Table" border="1">
<tbody>
<tr>
<td>Zip</td>
</tr>
</tbody>
</table>
</div>
</div>

How do I supply a class attribute for a table in html?

Cheers,
Murray

Discussion

  • Robert Stayton

    Robert Stayton - 2014-11-13

    Well, it seems this should be straightforward, but it is not. The template that generates the

    element for HTML output is in table.xsl and starts with:
     
  • Murray Lang

    Murray Lang - 2014-11-13

    Thanks Bob,

    I'm not steeped in HTML+CSS development so it didn't click that I could use the hierarchy to identify those particular tables.

    Happy again!

    Cheers,
    Murray

     
  • Robert Stayton

    Robert Stayton - 2015-07-31
    • status: open --> pending-fixed
    • assigned_to: Robert Stayton
     
  • Robert Stayton

    Robert Stayton - 2015-07-31

    I checked in a fix for this bug. It's not working in the docbook-xsl-snapshot builds.