XSL:FO Brief erstellen

kirashet

Mitglied
Hallo,

ich habe ein Problem mit der Erstellung einer XSL:FO Datei.
Es geht darum Serienbriefe respektive Kontoauszüge für n-Kunden zu erstellen.

Der XML-Aufbau sieht vereinfacht wie folgt aus:
Code:
<data>
 <page>
  <name>
	Mr. X
  </name>
  <street>
  	X-Street 1
  </street>
  <city>
	Ownedtown
  </city>
  <header>
	Accountstatement
  </header>
  <maintext>
	Foo Bar
  </maintext>
  <column0>
	Documentnumber
  </column0>
  <column1>
	Documenttext
  </column1>
  <column2>
	Debit/Credit
  </column2>
  <body>
   <voucher>
    <docnumber>
	1
    </docnumber>
    <doctext>
	Invoice
    </doctext>
    <amount>
	100
    </amount>
   </voucher>
	.
   n-vouchers
	.
   <voucher>
    <docnumber>
	100
    </docnumber>
    <doctext>
	Invoice
    </doctext>
    <amount>
	120
    </amount>
   </voucher>
  </body>
 </page>
 <page>
	same as obove
 </page>	
</data>

Ein 'page' ist sozusagen ein Kunde mit ihren n-Belegen. Die erste Seite soll die Empfangsadresse, den Betreff,
die Spaltennamen enthalten, danach die einzelnen Belege, tabellenartig.
Das funktioniert auch ganz gut, nur wenn es zu einem Seitenwechsel kommt, wird die Empfangsadresse usw. auch "mitgedruckt".
Ich möchte jedoch, dass auf den folgenden Seiten nur die Belege gedruckt werden.

Die zugehörige FO-Datei:

Code:
<xsl:template match ="/">
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
		<fo:layout-master-set>
			<fo:simple-page-master 	master-reference="main" 
						page-height="29.7cm" 
						page-width="21cm" 
						margin-top="6.0cm" 
						margin-bottom="1.5cm" 
						margin-left="1.5cm" 
						margin-right="1.5cm">
				<fo:region-before extent="8.0cm"/>
				<fo:region-after extent="2.0cm"/>
				<fo:region-body margin-top="7.0cm" margin-bottom="0.5cm"/>
			</fo:simple-page-master>
		</fo:layout-master-set>
		<xsl:for-each select="data/page">
		<fo:page-sequence master-name="main" initial-page-number="1">
			<fo:static-content flow-name="xsl-region-before">
                        	<fo:table table-layout="fixed" padding="3pt">
                                        <fo:table-column column-width="10cm"/>
					<fo:table-column column-width="8cm"/>
                                        <fo:table-header>
                                        <fo:table-row>
							<fo:table-cell>
								<fo:block 	text-align="left" 
										font-size="10pt" 
										font-family="Courier" 
										line-height="14pt">
                                                                                        <xsl:apply-templates select="title"/>
                                                                                        <fo:block></fo:block>
                                                                                        <xsl:apply-templates select="name1"/>
                                                                                        <fo:block></fo:block>
											<xsl:apply-templates select="name2"/>
                                                                                        <fo:block></fo:block>
                                                                                        <xsl:apply-templates select="street"/>
                                                                                        <fo:block></fo:block>
                                                                                        <xsl:apply-templates select="postalcode"/><xsl:apply-templates select="city"/>
								</fo:block>
							</fo:table-cell>
					</fo:table-row>
					<fo:table-row>
                                                        <fo:table-cell number-columns-spanned="2">
                                                            <fo:block font-family="Courier" font-size="10pt" text-align="left">
                                                                <xsl:apply-templates select="header"/>
                                                            </fo:block>
        						</fo:table-cell>
                                        </fo:table-row>
	                                <fo:table-row>
                                                        <fo:table-cell number-columns-spanned="2">
								<fo:block font-family="Courier" font-size="10pt" text-align="left">
                                                                    <xsl:apply-templates select="maintext"/>
                                                                </fo:block>
							</fo:table-cell>
                                         </fo:table-row>
        </fo:table-body>
				</fo:table>
                                <fo:table table-layout="fixed" padding="1pt">
                                        <fo:table-column column-width="2.6cm"/>
                                        <fo:table-column column-width="2.0cm"/>
                                        <fo:table-column column-width="2.3cm"/>
					<fo:table-header>
						<fo:table-row>
							<fo:table-cell >
								<fo:block font-family="Courier" font-size="10pt" text-align="left">
                                                                    <xsl:apply-templates select="column0"/>
								</fo:block>
							</fo:table-cell>
							<fo:table-cell>
								<fo:block font-family="Courier" font-size="10pt" text-align="left"  > <!-- white-space-collapse="false">-->
                                                                    <xsl:apply-templates select="column1"/>
								</fo:block>
							</fo:table-cell>
                                                        <fo:table-cell>
								<fo:block font-family="Courier" font-size="10pt" text-align="left"  > <!-- white-space-collapse="false">-->
                                                                    <xsl:apply-templates select="column2"/>
								</fo:block>
                                                        </fo:table-cell>
						</fo:table-row>
                                        </fo:table-header>
                                        <fo:table-body>
                                        </fo:table-body>
				</fo:table>
			</fo:static-content>
			<fo:flow flow-name="xsl-region-body">
				<xsl:apply-templates/>
			</fo:flow>
		</fo:page-sequence>
	</xsl:for-each>
	</fo:root>
	</xsl:template>
	<xsl:template match="data/page/body/voucher" >
            <fo:table table-layout="fixed" padding="1pt">
                <fo:table-column column-width="2.6cm"/>
                <fo:table-column column-width="2.0cm"/>
                <fo:table-column column-width="2.3cm"/>
                <fo:table-header>
		<fo:table-row>
                    <fo:table-cell >
                        <fo:block font-family="Courier" font-size="10pt" text-align="left">
                            <xsl:apply-templates select="docnumber"/>
			</fo:block>
                    </fo:table-cell>
                    <fo:table-cell >
                        <fo:block font-family="Courier" font-size="10pt" text-align="left">
                            <xsl:apply-templates select="doctext"/>
			</fo:block>
                    </fo:table-cell>
                    <fo:table-cell >
                        <fo:block font-family="Courier" font-size="10pt" text-align="right" border-width="1mm"> <!-- white-space-collapse="false">-->
                            <xsl:apply-templates select="amount"/>
			</fo:block>
                    </fo:table-cell>
                </fo:table-row>
                </fo:table-header>
                <fo:table-body>
                </fo:table-body>
            </fo:table>
        </xsl:template>

Vielleicht kann mir jemand von euch einen guten Tipp geben.

Vielen Dank.

Gruß
Kirashet
 

Neue Beiträge

Zurück