xsl-list
[Top] [All Lists]

Re: [xsl] xslfo table paging

2008-07-16 06:40:26
philip(_dot_)vallone(_at_)verizon(_dot_)net wrote:
Hi Max,
The FOP forum on nabble might be a better place as I think your question is related to XSL-Fo. see http://www.nabble.com/FOP---Users-f353.html.

Nevertheless, can you post some of the relevant FO/xsl?

Phil
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>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>