View Single Post
  #6 (permalink)  
Old April 27th, 2011, 12:07 PM
bonekrusher bonekrusher is offline
Friend of Wrox
Points: 1,676, Level: 16
Points: 1,676, Level: 16 Points: 1,676, Level: 16 Points: 1,676, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2006
Location: , , .
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Hi Vishal,

Always happy to help. Your post said you were having trouble with the first page being blank, which I believe I answered. If you are having formatting issues, I would suggest doing some more reading on FO.

With that said, if you only want 10 labels per page you can add a page break:

Code:
<xsl:if test="(position() mod 10) = 0">
                <xsl:attribute name="break-after"><xsl:text>page</xsl:text></xsl:attribute>
</xsl:if>
But you will have to rewrite your xslt to do this. You have asked for a cell height of 5cm, which causes a lot of whitespace.
Code:
height="5cm"
In addition, you have leaders nested in fo:blocks, which causes white space

Code:
<fo:block text-align="left" font-size="20pt">
                        <fo:leader/>
</fo:block>
This is just a sample of how to do your conditional formatting. You will have to modify this code to get the desired output.

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:template match="/candidates">
        <fo:root>
            <fo:layout-master-set>
                <fo:simple-page-master master-name="my-page" page-width="8in" page-height="11.5in">
                    <fo:region-body margin-top="0.80in" margin-bottom="0.20in" margin-left="0.20in" margin-right="0.20in"/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="my-page">
                <fo:flow flow-name="xsl-region-body">
                    <fo:block>
                        <fo:table text-align="center" border-spacing="3pt">
                            <fo:table-column column-number="1"/>
                            <fo:table-column column-number="2"/>
                            <fo:table-header>
                                <fo:table-row>
                                    <fo:table-cell number-columns-spanned="2">
                                        <fo:block/>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-header>
                            <fo:table-body>
                                <xsl:apply-templates select="report-bO/candidate-ro-details"/>
                            </fo:table-body>
                        </fo:table>
                    </fo:block>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>
    <xsl:template match="report-bO/candidate-ro-details">
        <fo:table-row>
            <xsl:if test="(position() mod 10) = 0">
                <xsl:attribute name="break-after"><xsl:text>page</xsl:text></xsl:attribute>
            </xsl:if>
            <fo:table-cell number-columns-spanned="2">
                <fo:block>
                    <fo:block text-align="left" margin-left="40pt" font-size="10pt" white-space-collapse="false" white-space-treatment="preserve">
                        <xsl:value-of select="attendancenumber"/>
                    </fo:block>
                    <fo:block text-align="left" margin-left="40pt" font-size="10pt" white-space-collapse="false" white-space-treatment="preserve">
                        <xsl:value-of select="roname"/>
                    </fo:block>
                    <fo:block text-align="left" margin-left="40pt" font-size="10pt" white-space-collapse="false" white-space-treatment="preserve">
                        <xsl:value-of select="contactname"/>
                    </fo:block>
                    <fo:block text-align="left" margin-left="40pt" font-size="10pt" white-space-collapse="false" white-space-treatment="preserve">
                        <xsl:value-of select="filecasenumber"/>
                    </fo:block>
                    <fo:block text-align="left" margin-left="40pt" font-size="10pt">
                        <xsl:value-of select="addressline1"/>
                    </fo:block>
                    <fo:block text-align="left" margin-left="40pt" font-size="10pt">
                        <xsl:value-of select="addressline2"/>
                    </fo:block>
                    <fo:block text-align="left" margin-left="40pt" font-size="10pt">
                        <xsl:value-of select="addressline3"/>
                        <xsl:choose>
                            <xsl:when test="(string-length(addressline4)&gt;0)">, <xsl:value-of select="addressline4"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <fo:leader/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </fo:block>
                    <fo:block text-align="left" margin-left="40pt" font-size="10pt">
                        <xsl:value-of select="addressline5"/>
                        <xsl:choose>
                            <xsl:when test="(string-length(addressline6)&gt;0)">, <xsl:value-of select="addressline6"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <fo:leader/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </fo:block>
                </fo:block>
            </fo:table-cell>
        </fo:table-row>
    </xsl:template>
</xsl:stylesheet>
Reply With Quote