<!-- * See M. E. Lesk, "Tbl – A Program to Format Tables" for details -->
<!-- * on tbl(1) and its markup syntaxt. -->
<!-- * -->
+ <!-- * http://cm.bell-labs.com/7thEdMan/vol2/tbl -->
<!-- * http://cm.bell-labs.com/cm/cs/doc/76/tbl.ps.gz -->
<!-- * http://www.snake.net/software/troffcvt/tbl.html -->
<!-- * stylesheets (which we import) are used to process those; but -->
<!-- * for the element child content of <entry> and <td>, the -->
<!-- * templates in the manpages stylesheet get applied; so the result -->
- <!-- * is a table marked up in HTML <tr><td>, etc., markup, but with -->
- <!-- * all contents of each <td> cell marked up correctly in roff -->
- <xsl:param name="contents-tree">
- <xsl:apply-templates/>
+ <!-- * is a table marked up in HTML <tr><td>, etc., markup. -->
+ <xsl:param name="html-table-output">
+ <xsl:choose>
+ <xsl:when test=".//tr">
+ <!-- * If this table has a TR child, it means that it's an -->
+ <!-- * HTML table in the DocBook source, instead of a CALS -->
+ <!-- * table. So we just copy it as-is, while wrapping it -->
+ <!-- * in a Table element -->
+ <table>
+ <xsl:copy-of select="*"/>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- * Otherwise, this is a CALS table in the DocBook source, -->
+ <!-- * so we need to apply the templates in the HTML -->
+ <!-- * stylesheets to transform it into HTML before we do -->
+ <!-- * any further processing of it. -->
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:param>
- <xsl:param name="contents" select="exsl:node-set($contents-tree)"/>
+ <xsl:param name="contents" select="exsl:node-set($html-table-output)"/>
<xsl:for-each select="$contents/table">
<!-- * ============================================================== -->
<!-- * the roff-formatted contents of the corresponding original table -->
<!-- * cell. -->
<cell row="{$row}" slot="{$slot}" type="l" colspan="{@colspan}">
- <xsl:apply-templates/>
+ <xsl:choose>
+ <xsl:when test=".//tr">
+ <xsl:message>Warn: Discarding nested table. Not supported in tbl(1).</xsl:message>
+ <xsl:text>[Source had nested] </xsl:text>
+ <xsl:text>[table, but tbl(1)] </xsl:text>
+ <xsl:text>[lacks any support] </xsl:text>
+ <xsl:text>[for nested table;] </xsl:text>
+ <xsl:text>[so was discarded.]</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
</cell>
<xsl:if test="@rowspan and @rowspan > 0">
<!-- * For each instance of a rowspan attribute found, we create N -->
<xsl:apply-templates/>
</xsl:template>
- <xsl:template match="td/table">
- <xsl:message>Warn: Discarding nested table. Not supported in tbl(1).</xsl:message>
- <xsl:text>[Nested table. Not supported in tbl(1).]</xsl:text>
- </xsl:template>
-
</xsl:stylesheet>