OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] html table, create wrapper div with class


Usually you can control the class attributes in HTML output by creating custom templates in mode="class.value" for each element, as described here:

ÂÂ http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#CustomClassValues

Tables are a bit funny, it seems, because of the multiple wrapper layers that are added for things like landscape. HTML source tables also differ by copying through the class attribute on the source table to the output table. When I use this template on a captioned source table with class="tabular":

<xsl:template match="d:table" mode="class.value">
 <xsl:text>tabular-wrapper</xsl:text>
</xsl:template>

I get this result:

<div class="tabular-wrapper">
 <title>...
 <div class="tabular-wrapper-contents">
ÂÂÂ <table class="tabular">

If you need further control, you'll have to customize some of the internal table templates.

Bob Stayton
bobs@sagehill.net
On 8/29/2019 6:27 AM, Tim Arnold wrote:
Hi,
I'm converting DocBook 5 to html (docbook-xsl-1.79.2) with a customization layer.
I now need to wrap my table elements inside a div with a particular class (say 'tabular-wrapper' for example).
My tables in the DocBook XML source are HTML tables.

Currently the tables are rendered by the stylesheet as:
ÂÂÂ <div id="the_id" class="">
    <div class="-contents">
     <table class="tabular"> ... </table>
    </div>
ÂÂÂ </div>


I want the tables to look like this:
  <div id="the_id" class="tabular-wrapper">
    <div class="-contents">
     <table class="tabular"> ... </table>
    </div>
ÂÂÂÂ </div>

or perhaps
  <div id="the_id" class="">
    <div class="-contents tabular-wrapper">
     <table class="tabular"> ... </table>
    </div>
ÂÂÂÂ </div>


It appears that the $class variable the formal.xsl stylesheet (htmlTable.with.caption template) refers to is blank.
<div class="{$class}">

As a last resort, I can copy the template into my customization layer with appropriate edits.

My question is whether that is the best I can do?
Or is there a way to populate the $class variable just for tables?

thanks for any ideas!
--Tim


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]