This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
keep-with-next problem
- From: "Mukhtar Ahmed" <mahmed at email dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 30 Nov 2001 19:17:43 +0800
- Subject: [xsl] keep-with-next problem
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello,
I am creating a pdf file to display region stats. I am using the keep-with-next attribute to keep all region-specific stats together when displayed. It does this (it seems) but my region's indentation is lost.
The code I am using is below, does any body have any suggestions. There maybe some typos, but they will be copy and paste errors as I have ran it successfully.
Cheers Mukhtar
XML:
<table>
.....
<row type="R">
<title lang="EN">AFRICA</title>
</row>
<row type="F">
<title lang="EN">Nitrogenous Fertilizers</title>
<value>1234</value>
<symb>*</symb>
....
</row>
<row type="RA">
<title lang="EN">ALGERIA</title>
</row>
<row type="F">
<title lang="EN">Nitrogenous Fertilizers</title>
<value>45</value>
<symb></symb>
.......
</row>
<row type="FT">
<title lang="EN">Ammonium Nitrate</title>
<value>65</value>
<symb>*</symb>
.......
</row>
<row type="FT">
<title lang="EN">Other Complex Fert (N)</title>
<value>65757575</value>
<symb></symb>
.......
</table>
Output:
Page 1
AFRICA
Nitrogenous Fertilizers
Page 2:
ALGERIA
Nitrogenous Fertilizers
Ammonium Nitrate
Other Complex Fert (N)
Desired Output:
Page 1
AFRICA
Nitrogenous Fertilizers
Page 2:
ALGERIA <!--indented-->
Nitrogenous Fertilizers (F)
Ammonium Nitrate (FT)
Other Complex Fert (N)(FT)
TEMPLATE (within XSL) used
<xsl:template name="details">
<fo:flow flow-name="xsl-region-body"
font-size="6px"
font-family="Courier"
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="./table/row">
<fo:table-row keep-with-next="always"> <!-- Keep-with used on row ->
<fo:table-cell>
<xsl:choose>
<xsl:when test="./@type='FT' or ./@type='R' or ./@type='RA'">
<xsl:if test="./@type='R' or ./@type='RA'">
<fo:block font-size="7px" text-indent="12pt" font-weight="bold" space-after.optimum="0.5pt">
<xsl:value-of select="./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="./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="./title"/>
</fo:block>
</xsl:otherwise>
</xsl:choose>
</fo:table-cell>
<xsl:for-each select="./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::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::row[1]/@type='RA'">
<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::row[1]/@type='RA'">
<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::row[1]/@type='R'">
<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::row[1]/@type='R'">
<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>
--
_______________________________________________
1 cent a minute calls anywhere in the U.S.!
http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http://www.getpennytalk.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list