docbook-apps

Re: [docbook-apps] Troubles with table customization

  • 1.  Re: [docbook-apps] Troubles with table customization

    Posted 10-04-2007 23:55
    The processing of HTML-markup tables for HTML output in DocBook XSL is very simple. As described here:

    http://www.sagehill.net/docbookxsl/DocbookHtmlTables.html

    most of the HTML table elements are simply copied from the input to the output, along with any attributes. So one avenue of customization is to add any attributes to the HTML markup in the source.

    If doing it in source is not appropriate, then the XSL templates for such tables are very simple, and could easily be customized. Here are some examples:

    <xsl:template match="thead|tbody|tgroup|tr" mode="htmlTable">
    <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates mode="htmlTable"/>
    </xsl:copy>
    </xsl:template>

    <xsl:template match="th|td" mode="htmlTable">
    <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
    </xsl:copy>
    </xsl:template>

    You could stick in a xsl:call-template with name="tr.attributes" after the xsl:copy to add new attributes.

    Bob Stayton
    Sagehill Enterprises
    DocBook Consulting
    bobs@sagehill.net