</xsl:template>
-<xsl:template name="table.frame">
- <xsl:variable name="frame">
- <xsl:choose>
- <xsl:when test="../@frame">
- <xsl:value-of select="../@frame"/>
- </xsl:when>
- <xsl:otherwise>all</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="$frame='all'">
- <xsl:attribute name="border-left-style">
- <xsl:value-of select="$table.frame.border.style"/>
- </xsl:attribute>
- <xsl:attribute name="border-right-style">
- <xsl:value-of select="$table.frame.border.style"/>
- </xsl:attribute>
- <xsl:attribute name="border-top-style">
- <xsl:value-of select="$table.frame.border.style"/>
- </xsl:attribute>
- <xsl:attribute name="border-bottom-style">
- <xsl:value-of select="$table.frame.border.style"/>
- </xsl:attribute>
- <xsl:attribute name="border-left-width">
- <xsl:value-of select="$table.frame.border.thickness"/>
- </xsl:attribute>
- <xsl:attribute name="border-right-width">
- <xsl:value-of select="$table.frame.border.thickness"/>
- </xsl:attribute>
- <xsl:attribute name="border-top-width">
- <xsl:value-of select="$table.frame.border.thickness"/>
- </xsl:attribute>
- <xsl:attribute name="border-bottom-width">
- <xsl:value-of select="$table.frame.border.thickness"/>
- </xsl:attribute>
- <xsl:attribute name="border-left-color">
- <xsl:value-of select="$table.frame.border.color"/>
- </xsl:attribute>
- <xsl:attribute name="border-right-color">
- <xsl:value-of select="$table.frame.border.color"/>
- </xsl:attribute>
- <xsl:attribute name="border-top-color">
- <xsl:value-of select="$table.frame.border.color"/>
- </xsl:attribute>
- <xsl:attribute name="border-bottom-color">
- <xsl:value-of select="$table.frame.border.color"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$frame='bottom'">
- <xsl:attribute name="border-left-style">none</xsl:attribute>
- <xsl:attribute name="border-right-style">none</xsl:attribute>
- <xsl:attribute name="border-top-style">none</xsl:attribute>
- <xsl:attribute name="border-bottom-style">
- <xsl:value-of select="$table.frame.border.style"/>
- </xsl:attribute>
- <xsl:attribute name="border-bottom-width">
- <xsl:value-of select="$table.frame.border.thickness"/>
- </xsl:attribute>
- <xsl:attribute name="border-bottom-color">
- <xsl:value-of select="$table.frame.border.color"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$frame='sides'">
- <xsl:attribute name="border-left-style">
- <xsl:value-of select="$table.frame.border.style"/>
- </xsl:attribute>
- <xsl:attribute name="border-right-style">
- <xsl:value-of select="$table.frame.border.style"/>
- </xsl:attribute>
- <xsl:attribute name="border-top-style">none</xsl:attribute>
- <xsl:attribute name="border-bottom-style">none</xsl:attribute>
- <xsl:attribute name="border-left-width">
- <xsl:value-of select="$table.frame.border.thickness"/>
- </xsl:attribute>
- <xsl:attribute name="border-right-width">
- <xsl:value-of select="$table.frame.border.thickness"/>
- </xsl:attribute>
- <xsl:attribute name="border-left-color">
- <xsl:value-of select="$table.frame.border.color"/>
- </xsl:attribute>
- <xsl:attribute name="border-right-color">
- <xsl:value-of select="$table.frame.border.color"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$frame='top'">
- <xsl:attribute name="border-left-style">none</xsl:attribute>
- <xsl:attribute name="border-right-style">none</xsl:attribute>
- <xsl:attribute name="border-top-style">
- <xsl:value-of select="$table.frame.border.style"/>
- </xsl:attribute>
- <xsl:attribute name="border-bottom-style">none</xsl:attribute>
- <xsl:attribute name="border-top-width">
- <xsl:value-of select="$table.frame.border.thickness"/>
- </xsl:attribute>
- <xsl:attribute name="border-top-color">
- <xsl:value-of select="$table.frame.border.color"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$frame='topbot'">
- <xsl:attribute name="border-left-style">none</xsl:attribute>
- <xsl:attribute name="border-right-style">none</xsl:attribute>
- <xsl:attribute name="border-top-style">
- <xsl:value-of select="$table.frame.border.style"/>
- </xsl:attribute>
- <xsl:attribute name="border-bottom-style">
- <xsl:value-of select="$table.frame.border.style"/>
- </xsl:attribute>
- <xsl:attribute name="border-top-width">
- <xsl:value-of select="$table.frame.border.thickness"/>
- </xsl:attribute>
- <xsl:attribute name="border-bottom-width">
- <xsl:value-of select="$table.frame.border.thickness"/>
- </xsl:attribute>
- <xsl:attribute name="border-top-color">
- <xsl:value-of select="$table.frame.border.color"/>
- </xsl:attribute>
- <xsl:attribute name="border-bottom-color">
- <xsl:value-of select="$table.frame.border.color"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$frame='none'">
- <xsl:attribute name="border-left-style">none</xsl:attribute>
- <xsl:attribute name="border-right-style">none</xsl:attribute>
- <xsl:attribute name="border-top-style">none</xsl:attribute>
- <xsl:attribute name="border-bottom-style">none</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>
- <xsl:text>Impossible frame on table: </xsl:text>
- <xsl:value-of select="$frame"/>
- </xsl:message>
- <xsl:attribute name="border-left-style">none</xsl:attribute>
- <xsl:attribute name="border-right-style">none</xsl:attribute>
- <xsl:attribute name="border-top-style">none</xsl:attribute>
- <xsl:attribute name="border-bottom-style">none</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template match="table">
- <xsl:choose>
- <xsl:when test="tgroup|mediaobject|graphic">
- <xsl:call-template name="calsTable"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="." mode="htmlTable"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="calsTable">
+<!-- Unified handling of CALS and HTML tables, formal and not -->
+<!-- Creates a hierarchy of nested containers:
+ - Outer container does a float.
+ - Nested container does block-container for rotation
+ - Nested block contains title, layout table and footnotes
+ - Nested layout table placeholder template supports extensions.
+ - fo:table is innermost.
+ Created from the innermost and working out.
+ Not all layers apply to every table.
+-->
+<xsl:template match="table|informaltable">
<xsl:if test="tgroup/tbody/tr
|tgroup/thead/tr
|tgroup/tfoot/tr">
- <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
+ <xsl:message terminate="yes">
+ <xsl:text>Broken table: tr descendent of CALS Table.</xsl:text>
+ <xsl:text>The text in the first tr is: </xsl:text>
+ <xsl:value-of
+ select="(tgroup//tr)[1]"/>
+ </xsl:message>
+ </xsl:if>
+ <xsl:if test="not(tgroup) and .//row">
+ <xsl:message terminate="yes">
+ <xsl:text>Broken table: row descendent of HTML table.</xsl:text>
+ <xsl:text>The text in the first row is: </xsl:text>
+ <xsl:value-of
+ select=".//row[1]"/>
+ </xsl:message>
</xsl:if>
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
+ <!-- Contains fo:table, not title or footnotes -->
+ <xsl:variable name="table.content">
+ <xsl:call-template name="make.table.content"/>
</xsl:variable>
- <xsl:variable name="param.placement"
- select="substring-after(normalize-space($formal.title.placement),
- concat(local-name(.), ' '))"/>
-
- <xsl:variable name="placement">
- <xsl:choose>
- <xsl:when test="contains($param.placement, ' ')">
- <xsl:value-of select="substring-before($param.placement, ' ')"/>
- </xsl:when>
- <xsl:when test="$param.placement = ''">before</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$param.placement"/>
- </xsl:otherwise>
- </xsl:choose>
+ <!-- Optional layout table template for extensions -->
+ <xsl:variable name="table.layout">
+ <xsl:call-template name="table.layout">
+ <xsl:with-param name="table.content" select="$table.content"/>
+ </xsl:call-template>
</xsl:variable>
- <xsl:variable name="keep.together">
- <xsl:call-template name="dbfo-attribute">
- <xsl:with-param name="pis"
- select="processing-instruction('dbfo')"/>
- <xsl:with-param name="attribute" select="'keep-together'"/>
+ <!-- fo:block contains title, layout table, and footnotes -->
+ <xsl:variable name="table.block">
+ <xsl:call-template name="table.block">
+ <xsl:with-param name="table.layout" select="$table.layout"/>
</xsl:call-template>
</xsl:variable>
- <xsl:variable name="table.content">
- <fo:block id="{$id}"
- xsl:use-attribute-sets="table.properties">
-
- <xsl:if test="$keep.together != ''">
- <xsl:attribute name="keep-together.within-column">
- <xsl:value-of select="$keep.together"/>
- </xsl:attribute>
- </xsl:if>
-
- <xsl:if test="$placement = 'before'">
- <xsl:call-template name="formal.object.heading">
- <xsl:with-param name="placement" select="$placement"/>
- </xsl:call-template>
- </xsl:if>
-
- <xsl:for-each select="tgroup">
- <xsl:variable name="prop-columns"
- select=".//colspec[contains(@colwidth, '*')]"/>
- <fo:table xsl:use-attribute-sets="table.table.properties">
- <xsl:call-template name="table.frame"/>
- <xsl:if test="following-sibling::tgroup">
- <xsl:attribute name="border-bottom-width">0pt</xsl:attribute>
- <xsl:attribute name="border-bottom-style">none</xsl:attribute>
- <xsl:attribute name="padding-bottom">0pt</xsl:attribute>
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
- <xsl:attribute name="space-after">0pt</xsl:attribute>
- <xsl:attribute name="space-after.minimum">0pt</xsl:attribute>
- <xsl:attribute name="space-after.optimum">0pt</xsl:attribute>
- <xsl:attribute name="space-after.maximum">0pt</xsl:attribute>
- </xsl:if>
- <xsl:if test="preceding-sibling::tgroup">
- <xsl:attribute name="border-top-width">0pt</xsl:attribute>
- <xsl:attribute name="border-top-style">none</xsl:attribute>
- <xsl:attribute name="padding-top">0pt</xsl:attribute>
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
- <xsl:attribute name="space-before">0pt</xsl:attribute>
- <xsl:attribute name="space-before.minimum">0pt</xsl:attribute>
- <xsl:attribute name="space-before.optimum">0pt</xsl:attribute>
- <xsl:attribute name="space-before.maximum">0pt</xsl:attribute>
- </xsl:if>
- <xsl:if test="count($prop-columns) != 0 or
- $fop1.extensions != 0 or
- $fop.extensions != 0 or
- $passivetex.extensions != 0">
- <xsl:attribute name="table-layout">fixed</xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="."/>
- </fo:table>
- </xsl:for-each>
-
- <xsl:if test="$placement != 'before'">
- <xsl:call-template name="formal.object.heading">
- <xsl:with-param name="placement" select="$placement"/>
- </xsl:call-template>
- </xsl:if>
- </fo:block>
+ <!-- pgwide or orient container -->
+ <xsl:variable name="table.container">
+ <xsl:call-template name="table.container">
+ <xsl:with-param name="table.block" select="$table.block"/>
+ </xsl:call-template>
</xsl:variable>
- <xsl:variable name="footnotes">
- <xsl:if test=".//footnote">
- <fo:block font-family="{$body.fontset}"
- font-size="{$footnote.font.size}"
- keep-with-previous.within-column="always">
- <xsl:apply-templates select=".//footnote" mode="table.footnote.mode"/>
- </fo:block>
- </xsl:if>
+ <!-- float or not -->
+ <xsl:variable name="floatstyle">
+ <xsl:call-template name="floatstyle"/>
</xsl:variable>
<xsl:choose>
- <xsl:when test="@orient='land' and
- $fop.extensions = 0 and
- $passivetex.extensions = 0" >
- <fo:block-container reference-orientation="90"
- xsl:use-attribute-sets="list.block.spacing">
- <xsl:attribute name="width">
- <xsl:call-template name="table.width"/>
- </xsl:attribute>
- <fo:block>
- <!-- Such spans won't work in most FO processors since it does
- not follow the XSL spec, which says it must appear on
- an element that is a direct child of fo:flow.
- Some processors relax that requirement, however. -->
- <xsl:attribute name="span">
- <xsl:choose>
- <xsl:when test="@pgwide=1">all</xsl:when>
- <xsl:otherwise>none</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:copy-of select="$table.content"/>
- <xsl:copy-of select="$footnotes"/>
- </fo:block>
- </fo:block-container>
+ <xsl:when test="$floatstyle != ''">
+ <xsl:call-template name="floater">
+ <xsl:with-param name="position" select="$floatstyle"/>
+ <xsl:with-param name="content" select="$table.container"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <fo:block>
- <xsl:attribute name="span">
- <xsl:choose>
- <xsl:when test="@pgwide=1">all</xsl:when>
- <xsl:otherwise>none</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:copy-of select="$table.content"/>
- <xsl:copy-of select="$footnotes"/>
- </fo:block>
+ <xsl:copy-of select="$table.container"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+
<xsl:template match="equation">
<xsl:variable name="param.placement"
select="substring-after(normalize-space($formal.title.placement),
<xsl:call-template name="informal.object"/>
</xsl:template>
-<xsl:template match="informaltable">
- <xsl:choose>
- <xsl:when test="tgroup|mediaobject|graphic">
- <xsl:call-template name="informalCalsTable"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="." mode="htmlTable"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="informalCalsTable">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
-
- <xsl:variable name="keep.together">
- <xsl:call-template name="dbfo-attribute">
- <xsl:with-param name="pis"
- select="processing-instruction('dbfo')"/>
- <xsl:with-param name="attribute" select="'keep-together'"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:variable name="table.content">
- <xsl:for-each select="tgroup">
- <xsl:variable name="prop-columns"
- select=".//colspec[contains(@colwidth, '*')]"/>
- <fo:block xsl:use-attribute-sets="informaltable.properties">
- <xsl:if test="$keep.together != ''">
- <xsl:attribute name="keep-together.within-column"><xsl:value-of
- select="$keep.together"/></xsl:attribute>
- </xsl:if>
- <fo:table xsl:use-attribute-sets="table.table.properties">
- <xsl:call-template name="table.frame"/>
- <xsl:if test="following-sibling::tgroup">
- <xsl:attribute name="border-bottom-width">0pt</xsl:attribute>
- <xsl:attribute name="border-bottom-style">none</xsl:attribute>
- <xsl:attribute name="padding-bottom">0pt</xsl:attribute>
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
- <xsl:attribute name="space-after">0pt</xsl:attribute>
- <xsl:attribute name="space-after.minimum">0pt</xsl:attribute>
- <xsl:attribute name="space-after.optimum">0pt</xsl:attribute>
- <xsl:attribute name="space-after.maximum">0pt</xsl:attribute>
- </xsl:if>
- <xsl:if test="preceding-sibling::tgroup">
- <xsl:attribute name="border-top-width">0pt</xsl:attribute>
- <xsl:attribute name="border-top-style">none</xsl:attribute>
- <xsl:attribute name="padding-top">0pt</xsl:attribute>
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
- <xsl:attribute name="space-before">0pt</xsl:attribute>
- <xsl:attribute name="space-before.minimum">0pt</xsl:attribute>
- <xsl:attribute name="space-before.optimum">0pt</xsl:attribute>
- <xsl:attribute name="space-before.maximum">0pt</xsl:attribute>
- </xsl:if>
- <xsl:if test="count($prop-columns) != 0 or
- $fop.extensions != 0 or
- $fop1.extensions != 0 or
- $passivetex.extensions != 0">
- <xsl:attribute name="table-layout">fixed</xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="."/>
- </fo:table>
- </fo:block>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:variable name="footnotes">
- <xsl:if test=".//footnote">
- <fo:block font-family="{$body.fontset}"
- font-size="{$footnote.font.size}"
- keep-with-previous.within-column="always">
- <xsl:apply-templates select=".//footnote" mode="table.footnote.mode"/>
- </fo:block>
- </xsl:if>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="@orient='land'">
- <fo:block-container reference-orientation="90">
- <fo:block id="{$id}">
- <xsl:attribute name="span">
- <xsl:choose>
- <xsl:when test="@pgwide=1">all</xsl:when>
- <xsl:otherwise>none</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:copy-of select="$table.content"/>
- <xsl:copy-of select="$footnotes"/>
- </fo:block>
- </fo:block-container>
- </xsl:when>
- <xsl:otherwise>
- <fo:block id="{$id}">
- <xsl:attribute name="span">
- <xsl:choose>
- <xsl:when test="@pgwide=1">all</xsl:when>
- <xsl:otherwise>none</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:copy-of select="$table.content"/>
- <xsl:copy-of select="$footnotes"/>
- </fo:block>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
<xsl:template match="informaltable/textobject"></xsl:template>
<xsl:template match="informalequation">
</xsl:choose>
</xsl:if>
</xsl:template>
+
</xsl:stylesheet>
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
+<!-- Outputs an fo:table only, not the caption -->
<xsl:template match="table|informaltable" mode="htmlTable">
- <xsl:if test="tgroup/tbody/row
- |tgroup/thead/row
- |tgroup/tfoot/row">
- <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
- </xsl:if>
-
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
<xsl:variable name="numcols">
<xsl:call-template name="widest-html-row">
</xsl:call-template>
</xsl:variable>
- <xsl:variable name="footnotes">
- <xsl:if test=".//footnote">
- <fo:block font-family="{$body.fontset}"
- font-size="{$footnote.font.size}"
- keep-with-previous.within-column="always">
- <xsl:apply-templates select=".//footnote" mode="table.footnote.mode"/>
- </fo:block>
- </xsl:if>
+ <xsl:variable name="prop-columns"
+ select=".//col[contains(@width, '%')] |
+ .//colgroup[contains(@width, '%')]"/>
+
+ <xsl:variable name="table.width">
+ <xsl:call-template name="table.width"/>
</xsl:variable>
- <xsl:choose>
- <xsl:when test="caption">
- <fo:table-and-caption id="{$id}"
- xsl:use-attribute-sets="table.properties">
- <xsl:apply-templates select="caption" mode="htmlTable"/>
- <fo:table xsl:use-attribute-sets="table.table.properties">
- <xsl:choose>
- <xsl:when test="$fop.extensions != 0 or
- $passivetex.extensions != 0">
- <xsl:attribute name="table-layout">fixed</xsl:attribute>
- </xsl:when>
- </xsl:choose>
- <xsl:attribute name="width">
- <xsl:choose>
- <xsl:when test="@width">
- <xsl:value-of select="@width"/>
- </xsl:when>
- <xsl:otherwise>100%</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:call-template name="make-html-table-columns">
- <xsl:with-param name="count" select="$numcols"/>
- </xsl:call-template>
- <xsl:apply-templates select="thead" mode="htmlTable"/>
- <xsl:apply-templates select="tfoot" mode="htmlTable"/>
- <xsl:choose>
- <xsl:when test="tbody">
- <xsl:apply-templates select="tbody" mode="htmlTable"/>
- </xsl:when>
- <xsl:otherwise>
- <fo:table-body>
- <xsl:apply-templates select="tr" mode="htmlTable"/>
- </fo:table-body>
- </xsl:otherwise>
- </xsl:choose>
- </fo:table>
- </fo:table-and-caption>
- <xsl:copy-of select="$footnotes"/>
- </xsl:when>
- <xsl:otherwise>
- <fo:block id="{$id}"
- xsl:use-attribute-sets="informaltable.properties">
- <fo:table table-layout="fixed"
- xsl:use-attribute-sets="table.table.properties">
- <xsl:attribute name="width">
- <xsl:choose>
- <xsl:when test="@width">
- <xsl:value-of select="@width"/>
- </xsl:when>
- <xsl:otherwise>100%</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:call-template name="make-html-table-columns">
- <xsl:with-param name="count" select="$numcols"/>
- </xsl:call-template>
- <xsl:apply-templates select="thead" mode="htmlTable"/>
- <xsl:apply-templates select="tfoot" mode="htmlTable"/>
- <xsl:choose>
- <xsl:when test="tbody">
- <xsl:apply-templates select="tbody" mode="htmlTable"/>
- </xsl:when>
- <xsl:otherwise>
- <fo:table-body>
- <xsl:apply-templates select="tr" mode="htmlTable"/>
- </fo:table-body>
- </xsl:otherwise>
- </xsl:choose>
- </fo:table>
- </fo:block>
- <xsl:copy-of select="$footnotes"/>
- </xsl:otherwise>
- </xsl:choose>
+ <fo:table xsl:use-attribute-sets="table.table.properties">
+ <xsl:choose>
+ <xsl:when test="$fop.extensions != 0 or
+ $passivetex.extensions != 0">
+ <xsl:attribute name="table-layout">fixed</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="width">
+ <xsl:choose>
+ <xsl:when test="@width">
+ <xsl:value-of select="@width"/>
+ </xsl:when>
+ <xsl:when test="$table.width">
+ <xsl:value-of select="$table.width"/>
+ </xsl:when>
+ <xsl:otherwise>100%</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:call-template name="make-html-table-columns">
+ <xsl:with-param name="count" select="$numcols"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="thead" mode="htmlTable"/>
+ <xsl:apply-templates select="tfoot" mode="htmlTable"/>
+ <xsl:choose>
+ <xsl:when test="tbody">
+ <xsl:apply-templates select="tbody" mode="htmlTable"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:table-body start-indent="0pt" end-indent="0pt">
+ <xsl:apply-templates select="tr" mode="htmlTable"/>
+ </fo:table-body>
+ </xsl:otherwise>
+ </xsl:choose>
+ </fo:table>
+
</xsl:template>
<xsl:template match="caption" mode="htmlTable">
- <fo:table-caption>
- <fo:block>
- <xsl:apply-templates select=".." mode="object.title.markup">
- <xsl:with-param name="allow-anchors" select="1"/>
- </xsl:apply-templates>
- </fo:block>
- </fo:table-caption>
+ <!-- Handled by formal.object.heading -->
</xsl:template>
<xsl:template name="widest-html-row">
<xsl:for-each select="col|colgroup/col">
<fo:table-column>
<xsl:attribute name="column-number">
- <xsl:number from="table" level="any" format="1"/>
+ <xsl:number from="table|informaltable" level="any" format="1"/>
</xsl:attribute>
<xsl:if test="@width">
<xsl:attribute name="column-width">
- <xsl:value-of select="@width"/>
+ <xsl:choose>
+ <xsl:when test="$fop.extensions != 0 and
+ contains(@width, '%')">
+ <xsl:value-of select="concat('proportional-column-width(',
+ substring-before(@width, '%'),
+ ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@width"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:attribute>
</xsl:if>
</fo:table-column>
<xsl:template match="tbody" mode="htmlTable">
<fo:table-body border-bottom-width="0.25pt"
border-bottom-style="solid"
- border-bottom-color="black">
+ border-bottom-color="black"
+ start-indent="0pt"
+ end-indent="0pt">
<xsl:apply-templates mode="htmlTable"/>
</fo:table-body>
</xsl:template>
<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
<xsl:call-template name="table.cell.properties">
<xsl:with-param name="bgcolor.pi" select="$bgcolor"/>
+ <xsl:with-param name="rowsep.inherit" select="0"/>
+ <xsl:with-param name="colsep.inherit" select="0"/>
</xsl:call-template>
<fo:block>
<xsl:call-template name="table.cell.block.properties"/>
</xsl:template>
<xsl:template match="tfoot" mode="htmlTable">
- <fo:table-footer>
+ <fo:table-footer start-indent="0pt"
+ end-indent="0pt">
<xsl:apply-templates mode="htmlTable"/>
</fo:table-footer>
</xsl:template>
<fo:table-cell xsl:use-attribute-sets="th.style table.cell.padding">
<xsl:call-template name="table.cell.properties">
<xsl:with-param name="bgcolor.pi" select="$bgcolor"/>
+ <xsl:with-param name="rowsep.inherit" select="0"/>
+ <xsl:with-param name="colsep.inherit" select="0"/>
</xsl:call-template>
<fo:block>
<xsl:call-template name="table.cell.block.properties"/>
<fo:table-header border-bottom-width="0.25pt"
border-bottom-style="solid"
border-bottom-color="black"
+ start-indent="0pt"
+ end-indent="0pt"
font-weight="bold">
<xsl:apply-templates mode="htmlTable"/>
</fo:table-header>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:rx="http://www.renderx.com/XSL/Extensions"
xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table"
xmlns:xtbl="com.nwalsh.xalan.Table"
xmlns:lxslt="http://xml.apache.org/xslt"
<!-- ==================================================================== -->
+<xsl:template name="make.table.content">
+ <xsl:choose>
+ <xsl:when test="tgroup|mediaobject|graphic">
+ <xsl:call-template name="calsTable"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="htmlTable"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="calsTable">
+
+ <xsl:variable name="keep.together">
+ <xsl:call-template name="dbfo-attribute">
+ <xsl:with-param name="pis"
+ select="processing-instruction('dbfo')"/>
+ <xsl:with-param name="attribute" select="'keep-together'"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:for-each select="tgroup">
+
+ <xsl:variable name="prop-columns"
+ select=".//colspec[contains(@colwidth, '*')]"/>
+
+ <fo:table xsl:use-attribute-sets="table.table.properties">
+ <xsl:if test="$keep.together != ''">
+ <xsl:attribute name="keep-together.within-column">
+ <xsl:value-of select="$keep.together"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="table.frame"/>
+ <xsl:if test="following-sibling::tgroup">
+ <xsl:attribute name="border-bottom-width">0pt</xsl:attribute>
+ <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+ <xsl:attribute name="padding-bottom">0pt</xsl:attribute>
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
+ <xsl:attribute name="space-after">0pt</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0pt</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0pt</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="preceding-sibling::tgroup">
+ <xsl:attribute name="border-top-width">0pt</xsl:attribute>
+ <xsl:attribute name="border-top-style">none</xsl:attribute>
+ <xsl:attribute name="padding-top">0pt</xsl:attribute>
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
+ <xsl:attribute name="space-before">0pt</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0pt</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">0pt</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">0pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="count($prop-columns) != 0 or
+ $fop.extensions != 0 or
+ $fop1.extensions != 0 or
+ $passivetex.extensions != 0">
+ <xsl:attribute name="table-layout">fixed</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="."/>
+ </fo:table>
+ </xsl:for-each>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<!-- Placeholder template enables wrapping a fo:table in
+ another table for purposes of layout or applying
+ extensions such as XEP table-omit-initial-header to
+ create "continued" titles on page breaks. -->
+<xsl:template name="table.layout">
+ <xsl:param name="table.content" select="NOTANODE"/>
+
+ <xsl:copy-of select="$table.content"/>
+</xsl:template>
+
+<xsl:template name="table.block">
+ <xsl:param name="table.layout" select="NOTANODE"/>
+
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+
+ <xsl:variable name="param.placement"
+ select="substring-after(normalize-space(
+ $formal.title.placement), concat(local-name(.), ' '))"/>
+
+ <xsl:variable name="placement">
+ <xsl:choose>
+ <xsl:when test="contains($param.placement, ' ')">
+ <xsl:value-of select="substring-before($param.placement, ' ')"/>
+ </xsl:when>
+ <xsl:when test="$param.placement = ''">before</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$param.placement"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="self::table">
+ <fo:block id="{$id}"
+ xsl:use-attribute-sets="table.properties">
+ <xsl:if test="$placement = 'before'">
+ <xsl:call-template name="formal.object.heading">
+ <xsl:with-param name="placement" select="$placement"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:copy-of select="$table.layout"/>
+ <xsl:call-template name="table.footnote.block"/>
+ <xsl:if test="$placement != 'before'">
+ <xsl:call-template name="formal.object.heading">
+ <xsl:with-param name="placement" select="$placement"/>
+ </xsl:call-template>
+ </xsl:if>
+ </fo:block>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:block id="{$id}"
+ xsl:use-attribute-sets="informaltable.properties">
+ <xsl:copy-of select="$table.layout"/>
+ <xsl:call-template name="table.footnote.block"/>
+ </fo:block>
+ </xsl:otherwise>
+ </xsl:choose>
+
+
+</xsl:template>
+
+<!-- Output a table's footnotes in a block -->
+<xsl:template name="table.footnote.block">
+ <xsl:if test=".//footnote">
+ <fo:block keep-with-previous.within-column="always">
+ <xsl:apply-templates select=".//footnote" mode="table.footnote.mode"/>
+ </fo:block>
+ </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="table.container">
+ <xsl:param name="table.block"/>
+ <xsl:choose>
+ <xsl:when test="@orient='land' and
+ $fop.extensions = 0 and
+ $passivetex.extensions = 0" >
+ <fo:block-container reference-orientation="90"
+ padding="6pt"
+ xsl:use-attribute-sets="list.block.spacing">
+ <xsl:attribute name="width">
+ <xsl:call-template name="table.width"/>
+ </xsl:attribute>
+ <fo:block start-indent="0pt" end-indent="0pt">
+ <xsl:copy-of select="$table.block"/>
+ </fo:block>
+ </fo:block-container>
+ </xsl:when>
+ <xsl:when test="@pgwide = 1">
+ <fo:block span="all" start-indent="0pt" end-indent="0pt">
+ <xsl:copy-of select="$table.block"/>
+ </fo:block>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$table.block"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
<xsl:template name="empty.table.cell">
<xsl:param name="colnum" select="0"/>
</fo:table-cell>
</xsl:template>
+<!-- ==================================================================== -->
+<xsl:template name="table.frame">
+ <xsl:variable name="frame">
+ <xsl:choose>
+ <xsl:when test="../@frame">
+ <xsl:value-of select="../@frame"/>
+ </xsl:when>
+ <xsl:otherwise>all</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$frame='all'">
+ <xsl:attribute name="border-left-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-right-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-top-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-bottom-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-left-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-right-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-top-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-bottom-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-left-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-right-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-top-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-bottom-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$frame='bottom'">
+ <xsl:attribute name="border-left-style">none</xsl:attribute>
+ <xsl:attribute name="border-right-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-style">none</xsl:attribute>
+ <xsl:attribute name="border-bottom-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-bottom-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-bottom-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$frame='sides'">
+ <xsl:attribute name="border-left-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-right-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-top-style">none</xsl:attribute>
+ <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+ <xsl:attribute name="border-left-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-right-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-left-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-right-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$frame='top'">
+ <xsl:attribute name="border-left-style">none</xsl:attribute>
+ <xsl:attribute name="border-right-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-top-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$frame='topbot'">
+ <xsl:attribute name="border-left-style">none</xsl:attribute>
+ <xsl:attribute name="border-right-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-bottom-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-top-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-bottom-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-top-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-bottom-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$frame='none'">
+ <xsl:attribute name="border-left-style">none</xsl:attribute>
+ <xsl:attribute name="border-right-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-style">none</xsl:attribute>
+ <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:text>Impossible frame on table: </xsl:text>
+ <xsl:value-of select="$frame"/>
+ </xsl:message>
+ <xsl:attribute name="border-left-style">none</xsl:attribute>
+ <xsl:attribute name="border-right-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-style">none</xsl:attribute>
+ <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<!-- ==================================================================== -->
<xsl:template name="border">
<xsl:choose>
<!-- These processors don't support table-layout="auto" -->
<xsl:when test="$fop.extensions != 0 or
- $fop1.extensions != 0 or
+ $fop1.extensions != 0 or
$passivetex.extensions != 0">
<xsl:text>100%</xsl:text>
</xsl:when>