[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xslfo table paging

Subject: Re: xslfo table paging
From: Max <max@xxxxxxxxxxx>
Date: Wed, 16 Jul 2008 14:40:00 +0100
Re:  xslfo table paging
philip.vallone@xxxxxxxxxxx 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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.