[xsl] How to change values in fo:static-content

Subject: [xsl] How to change values in fo:static-content
From: "Hesselberth, Jan" <Jan.Hesselberth@xxxxxxxxxxxxxxxxxx>
Date: Fri, 5 Apr 2002 15:32:44 +0100
I am producing a report like 

CFR013DPRINT1 CLAS CONTROL ACCOUNT		 05/04/2002
Page 1
Transaction Type 	Debit Amount 	Credit Amount 	Net
QC006
Funds Movement
ADVANCE			0.00		 0.00 			0.00
DRAWDOWN 			0.00		 0.00 			0.00
FURTHER ADVANCE 		0.00 		 0.00 			0.00

However, I need to include the SPV_Group ID (line 3) in the heading (line 1)
for each change in SPV_Group ID such as 
CFR013DPRINT1 CLAS CONTROL ACCOUNT	 for QC006	 05/04/2002
Page 1

I seem to be going round in circles trying to achoeve this. Any help would
be appreciated.

I have the following xml:

<?xml version="1.0"?><!DOCTYPE Report
><Report><Header><RptTitle>CFR013DPRINT1 CLAS CONTROL
ACCOUNT</RptTitle><RptDate>05/04/2002</RptDate></Header>
<SPV_Group ID="QC006"><printCategory
ID="20"><TranName>ADVANCE</TranName><CRAmount>0</CRAmount><DRAmount>0</DRAmo
unt></printCategory><printCategory
ID="20"><TranName>DRAWDOWN</TranName><CRAmount>0</CRAmount><DRAmount>0</DRAm
ount></printCategory></SPV_Group>
<SPV_Group ID="N"><printCategory
ID="20"><TranName>ADVANCE</TranName><CRAmount>0</CRAmount><DRAmount>-6246600
</DRAmount></printCategory></SPV_Group>
<SPV_Group ID="ABC"><printCategory
ID="20"><TranName>ADVANCE</TranName><CRAmount>0</CRAmount><DRAmount>0</DRAmo
unt></printCategory></SPV_Group>
</Report>


and process it with the following xslt to produce a pdf report:

<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
 <fo:layout-master-set>
   <fo:simple-page-master master-name="CFR013D"
                  page-height="29.7cm" 
                  page-width="21cm"
                  margin-top="1cm" 
                  margin-bottom="0.5cm" 
                  margin-left="1cm" 
                  margin-right="1cm">
      <fo:region-body margin-top="1cm"/>
      <fo:region-before extent="1.5cm"/>
      <fo:region-after extent="1.5cm"/>
   </fo:simple-page-master>
 </fo:layout-master-set>
  <fo:page-sequence master-name="CFR013D" initial-page-number="auto">
    <fo:static-content flow-name="xsl-region-before">
	<xsl:apply-templates select="/Report"/>
    </fo:static-content>
	<fo:flow flow-name="xsl-region-body">
		<xsl:call-template name="Details"/>
	</fo:flow>
  </fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="/Report">
	<xsl:param name="Style" select="'tITLE'"/>
	<fo:table>
		<fo:table-column column-width ="11cm"/>
		<fo:table-column column-width ="5cm"/>
		<fo:table-column column-width ="2cm"/>
		<fo:table-body>
			<xsl:for-each select="Header">
				<fo:table-row>
				<fo:table-cell>
					<fo:block border-bottom-width="1pt"
border-bottom-style="solid"><xsl:value-of select="RptTitle"/></fo:block>
				</fo:table-cell>
				<fo:table-cell>
					<fo:block  border-bottom-width="1pt"
border-bottom-style="solid" text-align="end"><xsl:value-of
select="RptDate"/></fo:block>
				</fo:table-cell>
					<fo:table-cell>
						<fo:block
border-bottom-width="1pt" border-bottom-style="solid" line-height="14pt"
font-size="10pt" 
		text-align="end">Page <fo:page-number/></fo:block>
					</fo:table-cell>
				</fo:table-row>
			</xsl:for-each>
		</fo:table-body>
	</fo:table>
	<fo:block><xsl:value-of select="./@ID"/></fo:block>
	<fo:table>
		<fo:table-column column-width ="9cm"/>
		<fo:table-column column-width ="3cm"/>
		<fo:table-column column-width ="3cm"/>
		<fo:table-column column-width ="3cm"/>
		<fo:table-body>
			<fo:table-row xsl:use-attribute-sets="rowdets">
			<fo:table-cell>
				<fo:block>Transaction Type</fo:block>
				</fo:table-cell>
				<fo:table-cell>
					<fo:block text-align="end">Debit
Amount</fo:block>
				</fo:table-cell>
				<fo:table-cell>
						<fo:block
text-align="end">Credit Amount</fo:block>
				</fo:table-cell>
				<fo:table-cell>
						<fo:block
text-align="end">Net</fo:block>
				</fo:table-cell>
				</fo:table-row>
		</fo:table-body>
	</fo:table>
</xsl:template>
	<xsl:template name="Details">
	<xsl:param name="Style" select="'Report'"/>
	<xsl:for-each select="/Report/SPV_Group">
	<fo:block><xsl:value-of select="@ID"/></fo:block>
	<fo:table break-after="page" space-after="10pt"
border-after-style="solid" border-after-width="1pt">
		<fo:table-column column-width ="9cm"/>
		<fo:table-column column-width ="3cm"/>
		<fo:table-column column-width ="3cm"/>
		<fo:table-column column-width ="3cm"/>

	<fo:table-body>
		<xsl:for-each select="./printCategory">
			<xsl:if
test="not(@ID=preceding::printCategory[1]/@ID)">
			<fo:table-row>
				<fo:table-cell
xsl:use-attribute-sets="trannamecell" height="20pt">
					<xsl:choose>
					<xsl:when test="@ID = '20'">
					<fo:block
xsl:use-attribute-sets="trannameblock">Funds Movement</fo:block>
					</xsl:when>

etc.

Regards
	Jan









-------------------------------------------------------------------------- 
CONFIDENTIALITY 
The information contained in this e-mail and any files transmitted with it 
is private and confidential. It is intended for the named addressee only. 
If you are not the intended addressee you are prohibited from 
storing, copying or using the information in any way. 
If you received this e-mail due to a transmission error please notify the 
sender immediately. No liability is accepted by Northern Rock 
for any losses caused by viruses contracted during transit 
over the Internet or present in any receiving system. 
This e-mail is not intended to create legally binding commitments on 
behalf of Northern Rock plc, nor do its contents reflect the corporate 
views or policies of Northern Rock plc. 
-------------------------------------------------------------------------- 


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


Current Thread