[Home] [By Thread] [By Date] [Recent Entries]
philip.vallone@xxxxxxxxxxx wrote:
Hi Max,The table XSLT code is below. It just mimics html table code. Regards Max <xsl:template match="tbody">
<fo:table table-layout="fixed" width="100%">
<xsl:for-each select="tr[1]/th|tr[1]/td">
<fo:table-column column-width="proportional-column-width(1)" >
</fo:table-column>
</xsl:for-each><fo:table-body> <xsl:apply-templates /> </fo:table-body> </fo:table> </xsl:template> <!-- this one's easy; <tr> corresponds to <fo:table-row> --> <xsl:template match="tr"> <fo:table-row> <xsl:apply-templates/> </fo:table-row> </xsl:template> <!--
Handle table header cells. They should be bold
and centered by default. Look back at the containing
<table> tag to see if a border width was specified.
-->
<xsl:template match="th">
<fo:table-cell font-weight="bold" text-align="center">
<xsl:if test="ancestor::table[1]/@border > 0">
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-width">1pt</xsl:attribute>
</xsl:if>
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template><!--
Handle table data cells. Look back at the containing
<table> tag to see if a border width was specified.
-->
<xsl:template match="td">
<fo:table-cell>
<xsl:if test="ancestor::table/@border > 0">
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-width">1pt</xsl:attribute>
</xsl:if>
<fo:block>
<!-- set alignment to match that of <td> tag -->
<xsl:choose>
<xsl:when test="@align='left'">
<xsl:attribute name="text-align">start</xsl:attribute>
</xsl:when>
<xsl:when test="@align='center'">
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:when>
<xsl:when test="@align='right'">
<xsl:attribute name="text-align">end</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template>
|

Cart



