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

Hot to get n records per page-sequence

Subject: Hot to get n records per page-sequence
From: "Prateek Gupta" <pgupta@xxxxxxxxxx>
Date: Thu, 19 Dec 2002 19:17:00 -0500
table fixed height
Hi,
I am able to get 1 record per page sequence using the following XSL code. I
have been told that I can use mod and position() functions but I am unable
to apply those in my XSL. Can someone please tell what how I can get 3
records per page?
Here's my XML:
<ROWSET>
      <ROW num="203">
            <SSN>400-38-0000</SSN>
            <FIRST_NAME>Kathy</FIRST_NAME>
            <MIDDLE_NAME>M</MIDDLE_NAME>
            <LAST_NAME>Ferrell</LAST_NAME>
            <SEX>F</SEX>
            <BIRTH_DATE>09/20/1958</BIRTH_DATE>
            <HOME_PHONE>234-332-2345</HOME_PHONE>
            <ADDR_LINE1>Leahurst Court</ADDR_LINE1>
            <CITY>Louisville</CITY>
            <STATE>KY</STATE>
            <ZIP_CD>40216</ZIP_CD>
            <CLASS_DESCRIPTION>LOUISVILLE TRADITIONAL</CLASS_DESCRIPTION>
      </ROW>
      <ROW num="204">
            <SSN>488-50-7886</SSN>
            <FIRST_NAME>Donna</FIRST_NAME>
            <MIDDLE_NAME>M</MIDDLE_NAME>
            <LAST_NAME>Ferrill</LAST_NAME>
            <SEX>F</SEX>
            <BIRTH_DATE>09/10/1962</BIRTH_DATE>
            <HOME_PHONE>234-332-2345</HOME_PHONE>
            <ADDR_LINE1>Keys Ferry Road</ADDR_LINE1>
            <CITY>Fairdale</CITY>
            <STATE>KY</STATE>
            <ZIP_CD>40118</ZIP_CD>
            <CLASS_DESCRIPTION>LOUISVILLE MODIFIED</CLASS_DESCRIPTION>
            <DEPENDANTS>Rachel Ferrill (Child)|Amanda Ferrill (Child)
|Joseph Ferrill (Spouse)</DEPENDANTS>
      </ROW>
      <ROW>
      - - - - - - - - -
      </ROW>
      <REPORT_NAME>Report Name</REPORT_NAME>
      <REPORT_HEADER>Report Header</REPORT_HEADER>
      <REPORT_RUN_DATE>2002-12-17 02:02:18</REPORT_RUN_DATE>
</ROWSET>

My XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
                xmlns:fo="http://www.w3.org/1999/XSL/Format">


  <xsl:output method="xml" encoding="UTF-8" indent="yes"/>


  <xsl:template match="/">
    <fo:root>
      <fo:layout-master-set>
        <!-- Define a body (or default) page. -->
        <fo:simple-page-master master-name="default-master">

          <!-- Central part of page -->
          <fo:region-body/>

          <fo:region-before/>

          <fo:region-after/>
        </fo:simple-page-master>
      </fo:layout-master-set>

      <xsl:apply-templates select="/ROWSET/ROW">
      </xsl:apply-templates>
    </fo:root>
  </xsl:template>


<xsl:template match="ROW">
      <!-- Body page -->
      <fo:page-sequence master-reference="default-master">

        <!-- Define the contents of the header. -->

        <fo:static-content flow-name="xsl-region-before">
          <fo:block>
            <fo:table table-layout="fixed" height="13.2mm">
              <fo:table-column column-width="40mm"/>
              <fo:table-column column-width="85mm"/>
              <fo:table-body>
                <fo:table-row>
                  <fo:table-cell>
                    <fo:block>
                      Something Here
                    </fo:block>
                  </fo:table-cell>
                  <fo:table-cell background-color="white" display-align
="center">
                    <fo:table table-layout="fixed" height="7.2mm">
                      <fo:table-column column-width="80mm"/>
                      <fo:table-body>
                        <fo:table-row>
                          <fo:table-cell padding-bottom="1.2mm">
                            <fo:block font-size="10pt" vertical-align
="middle" text-align="center">
                              <fo:inline vertical-align
="middle"><xsl:value-of select="ROWSET/REPORT_NAME"/></fo:inline>
                            </fo:block>
                          </fo:table-cell>
                        </fo:table-row>
                      </fo:table-body>
                    </fo:table>
                  </fo:table-cell>
                </fo:table-row>
              </fo:table-body>
            </fo:table>
          </fo:block>
        </fo:static-content>

        <!-- Define the contents of the footer. -->
        <fo:static-content flow-name="xsl-region-after">
          <fo:block font-size="6.0pt" font-family="sans-serif"
              padding="4.0pt" space-before="4.0pt"
              text-align="center" border-top-style="solid"
              border-bottom-width="1.0pt">
            <xsl:text>Page </xsl:text>
            <fo:page-number/>&nbsp;of&nbsp;<!--fo:page-number-citation
ref-id="{generate-id(/)}"/--></fo:block>
        </fo:static-content>

        <!-- The main contents of the body page, that is, the catalog
           entries -->
        <fo:flow flow-name="xsl-region-body">
          <fo:table table-layout="fixed">
            <fo:table-column column-width="20mm" background-color="white"/>
            <fo:table-column column-width="43mm" background-color="white"/>
            <fo:table-column column-width="20mm" background-color="white"/>
            <fo:table-column column-width="43mm" background-color="white"/>
            <fo:table-header>
              <fo:table-row background-color="#CCCCCC">
                <fo:table-cell number-columns-spanned="4" padding="4.0pt">
                  <fo:block><xsl:value-of select
="ROWSET/REPORT_HEADER"/></fo:block>
                </fo:table-cell>
              </fo:table-row>
              <fo:table-row background-color="white">
                <fo:table-cell number-columns-spanned="4">
                  <fo:block>&nbsp;</fo:block>
                </fo:table-cell>
              </fo:table-row>
            </fo:table-header>
            <fo:table-body>
              <fo:table-row keep-with-next="always">
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="right">
          <fo:inline>Name:</fo:inline>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="left" font-size="6pt" font-weight="normal">
          <xsl:value-of select="FIRST_NAME"/></fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="right" >
          <xsl:text>SSN:</xsl:text>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="left" font-size="6pt" font-weight="normal">
          <xsl:value-of select="SSN"/>
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row keep-with-previous="always">
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="right" >
          <xsl:text>Date of Birth:</xsl:text>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="left" font-size="6pt" font-weight="normal">
          <xsl:value-of select="BIRTH_DATE"/>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="right">
          <xsl:text>Sex:</xsl:text>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="left">
          <xsl:choose>
            <xsl:when test="SEX='F'">Female</xsl:when>
            <xsl:when test="SEX='M'">Male</xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="SEX"/>
            </xsl:otherwise>
          </xsl:choose>
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row keep-with-previous="always">
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="right">
          <xsl:text>Class:</xsl:text>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="left">
          <xsl:value-of select="CLASS_DESCRIPTION"/>
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row keep-with-previous="always">
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="right">
          <xsl:text>Address:</xsl:text>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt" number-columns-spanned="3">
        <fo:block text-align="left" font-size="6pt" font-weight="normal">
          <xsl:value-of select="ADDR_LINE1"/>
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row keep-with-previous="always">
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="right" >
          <xsl:text>County:</xsl:text>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="left" font-size="6pt" font-weight="normal">
          <xsl:value-of select="FIPS_COUNTY_NAME"/>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="right" >
          <xsl:text>Home Phone:</xsl:text>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt" number-columns-spanned="3">
        <fo:block text-align="left" font-size="6pt" font-weight="normal">
          <xsl:value-of select="HOME_PHONE"/>
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row keep-with-previous="always" keep-together="always">
      <fo:table-cell padding="1.0pt">
        <fo:block text-align="right">
          <xsl:text>Dependents:</xsl:text>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell padding="1.0pt" number-columns-spanned="3">
        <fo:block text-align="left" font-size="6pt" font-weight="normal">
        <xsl:value-of select="DEPENDANTS"/>
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row keep-with-previous="always">
      <fo:table-cell number-columns-spanned="4" padding="8.0pt">
        <fo:block border-bottom-style="solid" >
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
            </fo:table-body>
          </fo:table>
          <!--fo:block id="{generate-id(/)}">
            <xsl:text></xsl:text>
          </fo:block-->
        </fo:flow>
      </fo:page-sequence>
</xsl:template>
</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.