[xsl] for-each n number of times, multiple times

Subject: [xsl] for-each n number of times, multiple times
From: "Danny Gallagher" <dgallagher999@xxxxxxxxxxx>
Date: Tue, 23 Aug 2005 11:09:35 -0400
What I am trying to do (can't quite figure it out) is:

I will have many TRANSACTION elements in my xml, what I what is a predetermined number of one line outputs from each TRANSACTION on each page of the resulting pdf. My problem (I believe) is with how I am doing the xsl, not the fo. The current version of the xsl gives me the first group of sixty on one page, but I cannot figure out how to process the rest, sixty at a time. Any help would be greatly appreciated.
Thanks


Example xml (there would be multiple TRANSACTION elements)
<PAYMENTREPORT date="23-Aug-2005 09:02:02" expdate="20050823">
     <TRANSACTION><PAYMENT>
        <PMTTYP>FED</PMTTYP>
        <ENTMETH>Import</ENTMETH>
        <BATCHID>1000 Wires.txt-20050822090605-JIMG1</BATCHID>
        <TRKNO>JIMG1-000035-000998</TRKNO>
        <STATUS>Entered</STATUS>
        <APPSREQ>0</APPSREQ>
        <APPSREC>0</APPSREC>
        <PYMTVERSION>1</PYMTVERSION>
        <DRBANK>UBOC</DRBANK>
        <DRACCT>11111111</DRACCT>
        <DACTNAM>WWI ACCOUNT WITH EIGHT 1S</DACTNAM>
        <SNDREF>Bene Ref</SNDREF>
        <VDATE>20050830</VDATE>
        <DRCUR>USD</DRCUR>
        <DRAMT>0.00</DRAMT>
        <PMTCUR>USD</PMTCUR>
        <PMTAMT>10,000.10</PMTAMT>
        <ORDERCUST>
           <NAM>Orig Name 10</NAM>
           <ADDR1>Orig Address Line 1 11</ADDR1>
           <ADDR2>Orig Address Line 2 12</ADDR2>
           <ADDR3>Orig Address Line 3 13</ADDR3>
        </ORDERCUST>
        <INTBANK>
           <PITYPE>FW</PITYPE>
           <PI>011102638</PI>
           <NAM>NATIONAL IRON BANK SALISBURY</NAM>
           <ACCT>1222222222220</ACCT>
           <ADDR1>SALISBURY, CT</ADDR1>
        </INTBANK>
        <BENBANK>
           <PITYPE>FW</PITYPE>
           <PI>011001962</PI>
           <NAM>LIBERTY BANK AND TR COMPANY</NAM>
           <ADDR3>BOSTON, MA</ADDR3>
        </BENBANK>
        <BENE>
           <PI>123456789012</PI>
           <NAM>Bene name TEST 1</NAM>
           <ADDRTYPE>NA</ADDRTYPE>
           <ADDR1>Bene address line 1</ADDR1>
           <ADDR2>Bene address line 2</ADDR2>
           <ADDR3>Bene address line 3</ADDR3>
        </BENE>
        <DOP>
           <LINE1>DET of Pay Line 1</LINE1>
           <LINE2>DET of Pay Line 2</LINE2>
           <LINE3>DET of Pay Line 3</LINE3>
           <LINE4>DET of Pay Line 4</LINE4>
        </DOP>
        <BTB>
           <LINE1>BBI FP 1 21</LINE1>
           <LINE2>BBI 2 FP 2</LINE2>
           <LINE3>2BBI FP 3 23</LINE3>
           <LINE4>BBI 4 FP 24</LINE4>
        </BTB>
        <ADVICEINFO>ADVICE INFORMATION</ADVICEINFO>
        <ADVICEMETHOD>Telex</ADVICEMETHOD>
     </PAYMENT>
  </TRANSACTION>
</PAYMENTREPORT>

XSL:

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:fo="http://www.w3.org/1999/XSL/Format";>

<xsl:strip-space elements="*"/>

<xsl:output method="xml"/>

<xsl:include href="classpath://com/gainergroup/cte/resources/RptStyle.xsl"/>

<xsl:template match="PAYMENTREPORT">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master
master-name="page">
<fo:region-body region-name="body" margin-top="0.5in" margin-bottom="1in"
margin-left="0.5in" margin-right="0.5in">
</fo:region-body>
<fo:region-after region-name="footer" extent=".75in">
</fo:region-after>
</fo:simple-page-master>
<fo:simple-page-master
master-name="contentpage">
<fo:region-body region-name="contentbody" margin-top="0.5in" margin-bottom="1in"
margin-left="0.5in" margin-right="0.5in">
</fo:region-body>
<fo:region-after region-name="footer" extent=".75in">
</fo:region-after>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="page">
<fo:static-content flow-name="footer" xsl:use-attribute-sets="base">
<fo:block text-align="center"> Page
<fo:page-number/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="body" xsl:use-attribute-sets="base">
<fo:table table-layout="fixed">
<fo:table-column column-width="40mm"/>
<fo:table-column column-width="135mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:external-graphic width="35mm" height="25mm">
<xsl:attribute name="src">
<xsl:value-of select="LOGO"/>
</xsl:attribute>
</fo:external-graphic>
</fo:table-cell>
<fo:table-cell>
<fo:block xsl:use-attribute-sets="title" space-after="32pt">
Wires Report - Summary
</fo:block>
<fo:block padding-top="6pt" xsl:use-attribute-sets="rundate">
Created: <xsl:value-of select="@date"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table table-layout="fixed">
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="65mm"/>
<fo:table-column column-width="37mm"/>
<fo:table-column column-width="15mm"/>
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="20mm"/>
<fo:table-body>
<fo:table-row height="16pt" xsl:use-attribute-sets="content">
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block text-align="left" xsl:use-attribute-sets="indivpaysection">
Type/ID
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="left" xsl:use-attribute-sets="indivpaysection">
Beneficiary Name
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="right" xsl:use-attribute-sets="indivpaysection">
Amount&#160;
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center" xsl:use-attribute-sets="indivpaysection">
Cur
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center" xsl:use-attribute-sets="indivpaysection">
Value Date
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="left" xsl:use-attribute-sets="indivpaysection">
Status
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
<xsl:call-template name="TRANSACTION"/>


       </fo:root>
       </xsl:template>



   <xsl:template name="TRANSACTION">
       <xsl:variable name="group" select="'60'"/>

<!-- <xsl:for-each select="//TRANSACTION/PAYMENT[ position() mod 60 = 1 ]"> -->
<fo:page-sequence master-reference="contentpage">
<fo:flow flow-name="contentbody">
<xsl:for-each select="//TRANSACTION[position() &lt;= $group]">


<fo:table table-layout="fixed">
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="65mm"/>
<fo:table-column column-width="37mm"/>
<fo:table-column column-width="15mm"/>
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="20mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block text-align="left" padding-top="2pt" xsl:use-attribute-sets="content">
<xsl:choose>
<xsl:when test="PAYMENT/TEMPID">
<xsl:value-of select="PAYMENT/TEMPID"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="PAYMENT/PMTTYP"/>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="left" padding-top="2pt" xsl:use-attribute-sets="content">
<xsl:value-of select="PAYMENT/BENE/NAM"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="right" padding-top="2pt" xsl:use-attribute-sets="content">
<xsl:value-of select="PAYMENT/PMTAMT"/>&#160;
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center" padding-top="2pt" xsl:use-attribute-sets="content">
<xsl:value-of select="PAYMENT/PMTCUR"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center" padding-top="2pt" xsl:use-attribute-sets="content">
<xsl:call-template name="vdateformat">
<xsl:with-param name="vdate" select="PAYMENT/VDATE"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="left" padding-top="2pt" xsl:use-attribute-sets="content">
<xsl:value-of select="PAYMENT/STATUS"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</xsl:template>
</xsl:stylesheet>


Current Thread