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

FO: Newbie - Forcing data onto the next page cont .....

From: Tanzila Mohammad <tmohammad@entier-solutions.com>
Date: Wed, 28 Nov 2001 13:15:20 -0000
To: <www-xsl-fo@w3.org>
Message-ID: <EBEKJPOMOCIKIIPPEBHBGEBKCIAA.tmohammad@entier-solutions.com>
Help please - I have been working with the attribute keep-with-next. I have
used it as illustrated in the template below using the following XML:

XML:
                <faostat:table>
                      .....
                         <faostat:table-row type="G">
				  <faostat:row-title lang="EN">AFRICA</faostat:row-title>
				</faostat:table-row>
				<faostat:table-row type="F">
				  <faostat:row-title lang="EN">Nitrogenous
Fertilizers</faostat:row-title>
				  <faostat:row-value>  ....</faostat:row-value>
				  <faostat:row-symb> </faostat:row-symb>
				  ....
				</faostat:table-row>
				<faostat:table-row type="D">
				  <faostat:row-title lang="EN">ALGERIA</faostat:row-title>
				</faostat:table-row>
				<faostat:table-row type="F">
				  <faostat:row-title lang="EN">Nitrogenous
Fertilizers</faostat:row-title>
				  <faostat:row-value>  82282096</faostat:row-value>
				  <faostat:row-symb> </faostat:row-symb>
				  .......
				</faostat:table-row>
  				<faostat:table-row type="FT">
				  <faostat:row-title lang="EN">Ammonium Nitrate</faostat:row-title>
				  <faostat:row-value>  82282096</faostat:row-value>
				  <faostat:row-symb> </faostat:row-symb>
				  .......
				</faostat:table-row>
                        <faostat:table-row type="FT">
				  <faostat:row-title lang="EN">Other Complex Fert
(N)</faostat:row-title>
				  <faostat:row-value>65757575</faostat:row-value>
				  <faostat:row-symb> </faostat:row-symb>
		.......
            </faostat:table>

My Output:

Page 1
   AFRICA
 Nitrogenous Fertilizers

Page 2:
 ALGERIA
 Nitrogenous Fertilizers
   Ammonium Nitrate
   Other Complex Fert (N)

It appears that Algeria's details were pushed onto page 2 as desired but the
indentation of the Country name is missing. It makes me think that the
method I employed was incorrect.

My Desired Output:
Page 1
   AFRICA
 Nitrogenous Fertilizers

Page 2:
   ALGERIA <!--indented-->
 Nitrogenous Fertilizers
   Ammonium Nitrate
   Other Complex Fert (N)


TEMPLATE (within XSL) used to

 <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 keep-with-next="always">  <!-- Keep-with used on table
row-->
       <fo:table-cell>
       <xsl:choose>
        <xsl:when test="./@type='FT' or ./@type='G' or ./@type='D'">
         <xsl:if test="./@type='G'">
          <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='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>
   <!--If statements to control the spaces between types -->
    <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>

Thanks.
Tanz
Received on Wednesday, 28 November 2001 08:14:48 GMT

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