<!-- ==================================================================== -->
-<xsl:attribute-set name="th.style">
- <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:attribute name="table-layout">fixed</xsl:attribute>
</xsl:when>
</xsl:choose>
+
<xsl:attribute name="width">
<xsl:choose>
<xsl:when test="@width">
<xsl:otherwise>100%</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
+
+ <xsl:call-template name="table.frame">
+ <xsl:with-param name="frame">
+ <xsl:choose>
+ <xsl:when test="@frame = 'box'">all</xsl:when>
+ <xsl:when test="@frame = 'border'">all</xsl:when>
+ <xsl:when test="@frame = 'below'">bottom</xsl:when>
+ <xsl:when test="@frame = 'above'">top</xsl:when>
+ <xsl:when test="@frame = 'hsides'">topbot</xsl:when>
+ <xsl:when test="@frame = 'vsides'">sides</xsl:when>
+ <xsl:when test="@frame = 'lhs'">lhs</xsl:when>
+ <xsl:when test="@frame = 'rhs'">rhs</xsl:when>
+ <xsl:when test="@frame = 'void'">none</xsl:when>
+ <xsl:when test="@border != '' and @border != 0">all</xsl:when>
+ <xsl:when test="@border != '' and @border = 0">none</xsl:when>
+ <xsl:when test="@frame != ''">
+ <xsl:value-of select="@frame"/>
+ </xsl:when>
+ <xsl:when test="$default.table.frame != ''">
+ <xsl:value-of select="$default.table.frame"/>
+ </xsl:when>
+ <xsl:otherwise>all</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+
<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:template>
+<!-- This template writes rowsep or colsep equivalant for html tables -->
+<xsl:template name="html.table.cell.rules">
+ <xsl:variable name="border"
+ select="(ancestor::table |
+ ancestor::informaltable)[last()]/@border"/>
+ <xsl:variable name="table.rules"
+ select="(ancestor::table |
+ ancestor::informaltable)[last()]/@rules"/>
+
+ <xsl:variable name="rules">
+ <xsl:choose>
+ <xsl:when test="$table.rules != ''">
+ <xsl:value-of select="$table.rules"/>
+ </xsl:when>
+ <xsl:when test="$default.table.rules != ''">
+ <xsl:value-of select="$default.table.rules"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$border != '' and $border != 0">
+ <xsl:attribute name="border">
+ <xsl:value-of select="$table.cell.border.thickness"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$table.cell.border.style"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$table.cell.border.color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$rules = 'none'">
+ <xsl:attribute name="border-start-style">none</xsl:attribute>
+ <xsl:attribute name="border-end-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:when test="$rules = 'cols' and following-sibling::*">
+ <!-- If not the last column, add border after -->
+ <xsl:attribute name="border-start-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-style">none</xsl:attribute>
+ <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+ <xsl:attribute name="border-end-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-end-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-end-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- If not the last row, add border below -->
+ <xsl:when test="$rules = 'rows'">
+ <xsl:variable name="rowborder">
+ <xsl:choose>
+ <!-- If in thead and tbody has rows, add border -->
+ <xsl:when test="parent::tr/parent::thead/
+ following-sibling::tbody/tr">1</xsl:when>
+ <!-- If in tbody and tfoot has rows, add border -->
+ <xsl:when test="parent::tr/parent::tbody/
+ following-sibling::tfoot/tr">1</xsl:when>
+ <xsl:when test="parent::tr/parent::tbody/
+ preceding-sibling::tfoot/tr">1</xsl:when>
+ <!-- If following rows, but not rowspan reaches last row -->
+ <xsl:when test="parent::tr/following-sibling::tr and
+ not(@rowspan = count(parent::tr/following-sibling::tr) + 1)">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:if test="$rowborder = 1">
+ <xsl:attribute name="border-start-style">none</xsl:attribute>
+ <xsl:attribute name="border-end-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:if>
+ </xsl:when>
+ <xsl:when test="$rules = 'all'">
+ <xsl:attribute name="border-start-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-style">none</xsl:attribute>
+
+ <xsl:variable name="rowborder">
+ <xsl:choose>
+ <!-- If in thead and tbody has rows, add border -->
+ <xsl:when test="parent::tr/parent::thead/
+ following-sibling::tbody/tr">1</xsl:when>
+ <!-- If in tbody and tfoot has rows, add border -->
+ <xsl:when test="parent::tr/parent::tbody/
+ following-sibling::tfoot/tr">1</xsl:when>
+ <xsl:when test="parent::tr/parent::tbody/
+ preceding-sibling::tfoot/tr">1</xsl:when>
+ <!-- If following rows, but not rowspan reaches last row -->
+ <xsl:when test="parent::tr/following-sibling::tr and
+ not(@rowspan = count(parent::tr/following-sibling::tr) + 1)">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:if test="$rowborder = 1">
+ <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:if>
+
+ <xsl:if test="following-sibling::*">
+ <!-- If not the last column, add border after -->
+ <xsl:attribute name="border-end-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-end-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-end-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$rules = 'groups' and ancestor::thead
+ and not(parent::tr/following-sibling::tr)">
+ <xsl:attribute name="border-start-style">none</xsl:attribute>
+ <xsl:attribute name="border-end-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="$rules = 'groups' and ancestor::tfoot
+ and not(parent::tr/preceding-sibling::tr)">
+ <xsl:attribute name="border-start-style">none</xsl:attribute>
+ <xsl:attribute name="border-end-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-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-top-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
<xsl:template match="caption" mode="htmlTable">
<!-- Handled by formal.object.heading -->
</xsl:template>
</xsl:template>
<xsl:template match="tbody" mode="htmlTable">
- <fo:table-body border-bottom-width="0.25pt"
- border-bottom-style="solid"
- border-bottom-color="black"
- start-indent="0pt"
+ <fo:table-body start-indent="0pt"
end-indent="0pt">
<xsl:apply-templates mode="htmlTable"/>
</fo:table-body>
</xsl:template>
-<xsl:template match="td" mode="htmlTable">
- <xsl:variable name="bgcolor.pi">
- <xsl:call-template name="pi.dbfo_bgcolor"/>
- </xsl:variable>
- <xsl:variable name="bgcolor">
- <xsl:choose>
- <xsl:when test="$bgcolor.pi != ''">
- <xsl:value-of select="$bgcolor.pi"/>
- </xsl:when>
- <xsl:when test="string-length(@bgcolor) != 0">
- <xsl:value-of select="@bgcolor"/>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
- <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>
-
- <xsl:if test="@colspan > 1">
- <xsl:attribute name="number-columns-spanned">
- <xsl:value-of select="@colspan"/>
- </xsl:attribute>
- </xsl:if>
-
- <xsl:if test="@rowspan > 1">
- <xsl:attribute name="number-rows-spanned">
- <xsl:value-of select="@rowspan"/>
- </xsl:attribute>
- </xsl:if>
-
- <fo:block>
- <xsl:call-template name="table.cell.block.properties"/>
- <xsl:apply-templates/>
- </fo:block>
- </fo:table-cell>
-</xsl:template>
-
<xsl:template match="tfoot" mode="htmlTable">
<fo:table-footer start-indent="0pt"
end-indent="0pt">
</fo:table-footer>
</xsl:template>
-<xsl:template match="th" mode="htmlTable">
+<xsl:template match="th|td" mode="htmlTable">
<xsl:variable name="bgcolor.pi">
<xsl:call-template name="pi.dbfo_bgcolor"/>
</xsl:variable>
+
<xsl:variable name="bgcolor">
<xsl:choose>
<xsl:when test="$bgcolor.pi != ''">
</xsl:when>
</xsl:choose>
</xsl:variable>
- <fo:table-cell xsl:use-attribute-sets="th.style table.cell.padding">
+ <xsl:variable name="align">
+ <xsl:call-template name="inherited.table.attribute">
+ <xsl:with-param name="entry" select="."/>
+ <xsl:with-param name="row" select="parent::tr"/>
+ <xsl:with-param name="attribute" select="'align'"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="valign">
+ <xsl:call-template name="inherited.table.attribute">
+ <xsl:with-param name="entry" select="."/>
+ <xsl:with-param name="row" select="parent::tr"/>
+ <xsl:with-param name="attribute" select="'valign'"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <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="align.inherit" select="$align"/>
+ <xsl:with-param name="valign.inherit" select="$valign"/>
<xsl:with-param name="colsep.inherit" select="0"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="thead" mode="htmlTable">
- <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">
+ <fo:table-header start-indent="0pt"
+ end-indent="0pt">
<xsl:apply-templates mode="htmlTable"/>
</fo:table-header>
</xsl:template>
<xsl:when test="self::table">
<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="$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:variable name="rowsep">
<xsl:choose>
<!-- If this is the last row, rowsep never applies (except when
- the ancestor tgroup has a following sibling tgroup) -->
+ the ancestor tgroup has a following sibling tgroup) -->
<xsl:when test="not(ancestor-or-self::row[1]/following-sibling::row
or ancestor-or-self::thead/following-sibling::tbody
or ancestor-or-self::tbody/preceding-sibling::tfoot)
- and not(ancestor::tgroup/following-sibling::tgroup)">
+ and not(ancestor::tgroup/following-sibling::tgroup)">
<xsl:value-of select="0"/>
</xsl:when>
<xsl:otherwise>
<!-- ==================================================================== -->
<xsl:template name="table.frame">
- <xsl:variable name="frame">
+ <xsl:param 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:param>
+
<xsl:choose>
<xsl:when test="$frame='all'">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
</xsl:when>
+ <xsl:when test="$frame='lhs'">
+ <xsl:attribute name="border-start-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-end-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-style">none</xsl:attribute>
+ <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+ <xsl:attribute name="border-start-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-start-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$frame='rhs'">
+ <xsl:attribute name="border-end-style">
+ <xsl:value-of select="$table.frame.border.style"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-end-style">none</xsl:attribute>
+ <xsl:attribute name="border-top-style">none</xsl:attribute>
+ <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+ <xsl:attribute name="border-end-width">
+ <xsl:value-of select="$table.frame.border.thickness"/>
+ </xsl:attribute>
+ <xsl:attribute name="border-end-color">
+ <xsl:value-of select="$table.frame.border.color"/>
+ </xsl:attribute>
+ </xsl:when>
<xsl:when test="$frame='top'">
<xsl:attribute name="border-start-style">none</xsl:attribute>
<xsl:attribute name="border-end-style">none</xsl:attribute>
<xsl:variable name="rowsep">
<xsl:choose>
<!-- If this is the last row, rowsep never applies (except when
- the ancestor tgroup has a following sibling tgroup) -->
+ the ancestor tgroup has a following sibling tgroup) -->
<xsl:when test="not(ancestor-or-self::row[1]/following-sibling::row
or ancestor-or-self::thead/following-sibling::tbody
or ancestor-or-self::tbody/preceding-sibling::tfoot)
- and not(ancestor::tgroup/following-sibling::tgroup)">
+ and not(ancestor::tgroup/following-sibling::tgroup)">
<xsl:value-of select="0"/>
</xsl:when>
<!-- Check for morerows too -->
following-sibling::row) = @morerows )
and not (ancestor-or-self::thead/following-sibling::tbody
or ancestor-or-self::tbody/preceding-sibling::tfoot)
- and not(ancestor::tgroup/following-sibling::tgroup)">
+ and not(ancestor::tgroup/following-sibling::tgroup)">
<xsl:value-of select="0"/>
</xsl:when>
<xsl:value-of select="$bgcolor.pi"/>
</xsl:attribute>
</xsl:if>
- <xsl:variable name="border"
- select="(ancestor::table |
- ancestor::informaltable)[last()]/@border"/>
- <xsl:if test="$border != '' and $border != 0">
- <xsl:attribute name="border">
- <xsl:value-of select="$table.cell.border.thickness"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$table.cell.border.style"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$table.cell.border.color"/>
+
+ <xsl:if test="$align.inherit != ''">
+ <xsl:attribute name="text-align">
+ <xsl:value-of select="$align.inherit"/>
</xsl:attribute>
</xsl:if>
+
+ <xsl:if test="$valign.inherit != ''">
+ <xsl:attribute name="display-align">
+ <xsl:choose>
+ <xsl:when test="$valign.inherit='top'">before</xsl:when>
+ <xsl:when test="$valign.inherit='middle'">center</xsl:when>
+ <xsl:when test="$valign.inherit='bottom'">after</xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:text>Unexpected valign value: </xsl:text>
+ <xsl:value-of select="$valign.inherit"/>
+ <xsl:text>, center used.</xsl:text>
+ </xsl:message>
+ <xsl:text>center</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:call-template name="html.table.cell.rules"/>
+
</xsl:otherwise>
</xsl:choose>