W3C home > Mailing lists > Public > www-xsl-fo@w3.org > November 2001

FO: Newbie - Forcing data onto the next page

From: Tanzila Mohammad <tmohammad@entier-solutions.com>
Date: Tue, 27 Nov 2001 11:52:34 -0000
To: <www-xsl-fo@w3.org>
Message-ID: <EBEKJPOMOCIKIIPPEBHBIEAECIAA.tmohammad@entier-solutions.com>
Need help! My problem is with implementing certain rules for pushing data
from one page to another:

Rules:
(1) If a country is displayed on the previous page and its data is on the
next page - the country should be displayed on the next page. i.e

Page 1:
........
<end of page> Algeria

Page 2:
<start of page>  Fertilizers   23  4532  52  25
                 Type 1       678 8897 897 879
                 Type 2       890 909  909 909

Would Require:
Page 2:
<start of page>  Algeria
                 Fertilizers   23  4532  52  25
                 Type 1       678 8897 897 879
                 Type 2       890 909  909 909

(2) If a continent starts 2/3 lines before the end of a page - the continent
should be displayed on the next page.


I have XSL in place to create the pages but it is just the code required to
implement the rules. The XSL template that deals with displaying the values
is as follows:

G = Continent
D = Country
F = Fertilizers
FT = Fertilizer types

<xsl:template name="bodyContents">

    <fo:flow flow-name="xsl-region-body"
              font-size="6px"
             font-family="Courier"
             font-weight="bold"
             space-before.optimum="10pt">

     <fo:table
          >
  <fo:table-column column-width="3.5cm"/>
  <fo:table-column column-width="1.25cm" number-columns-repeated="12"/>
        <fo:table-body>
     <xsl:for-each select="./faostat:table/faostat:table-row">

    <fo:table-row>
       <fo:table-cell>
       <xsl:choose>
        <xsl:when test="./@type='FT' or ./@type='G' or ./@type='D'">
         <xsl:if test="./@type='G' or ./@type='D'">
          <fo:block font-size="7px" text-indent="12pt" font-weight="bold"
space-after.optimum="0.5pt">
           <xsl:value-of select="./faostat:row-title"/>
          </fo:block>
         </xsl:if>
          <xsl:if test="./@type='FT'">
          <fo:block text-indent="8pt" font-weight="bold"
space-after.optimum="0.5pt">
           <xsl:value-of select="./faostat:row-title"/>
          </fo:block>
         </xsl:if>
        </xsl:when>
        <xsl:otherwise>
         <fo:block text-align="start" font-weight="bold"
space-after.optimum="0.5pt">
           <xsl:value-of select="./faostat:row-title"/>
          </fo:block>
        </xsl:otherwise>
       </xsl:choose>
       </fo:table-cell>
      <xsl:for-each select="./faostat:row-value">
       <fo:table-cell>
           <fo:block text-align="center" font-weight="bold"
space-after.optimum="0.5pt">
            <xsl:value-of select="."/>
             <xsl:value-of select="following-sibling::faostat:row-symb"/>
          </fo:block>
       </fo:table-cell>
      </xsl:for-each>
    </fo:table-row>
    <xsl:if test="./@type='F' and
following-sibling::faostat:table-row[1]/@type='D'">
        <fo:table-row>
        <fo:table-cell>
           <fo:block space-after.optimum="10pt">
            </fo:block>
         </fo:table-cell>
       </fo:table-row>
     </xsl:if>
     <xsl:if test="./@type='FT' and
following-sibling::faostat:table-row[1]/@type='D'">
        <fo:table-row>
           <fo:table-cell>
            <fo:block space-after.optimum="10pt">
            </fo:block>
           </fo:table-cell>
       </fo:table-row>
     </xsl:if>
      <xsl:if test="./@type='F' and
following-sibling::faostat:table-row[1]/@type='G'">
        <fo:table-row>
        <fo:table-cell>
           <fo:block space-after.optimum="10pt">
            </fo:block>
         </fo:table-cell>
       </fo:table-row>
     </xsl:if>
     <xsl:if test="./@type='FT' and
following-sibling::faostat:table-row[1]/@type='G'">
        <fo:table-row>
           <fo:table-cell>
            <fo:block space-after.optimum="10pt">
            </fo:block>
           </fo:table-cell>
       </fo:table-row>
     </xsl:if>
    </xsl:for-each>
    </fo:table-body>
</fo:table>
</fo:flow>
 </xsl:template>

Regards.
tanz
Received on Tuesday, 27 November 2001 06:52:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:08 GMT