W3C home > Mailing lists > Public > www-xsl-fo@w3.org > September 2004

Displaying Table contents

From: Devavrat <devavrat.bagayat@mentorix.com>
Date: Tue, 21 Sep 2004 12:09:36 +0530
To: <www-xsl-fo@w3.org>
Message-ID: <BEEDKPCONIOANNGMJHOLKEJICBAA.devavrat.bagayat@mentorix.com>
Hello,
	I want to display a set of data in tabular form.
All I saw in various helps concerning Apache FOP was, to display hard-coded
data in a tabular format, but in my case I want to display the data which is
available runtime and cannot be hard coded.
How can I achieve that.

Following is the xsl, what changes I need to make in here to display the
values in "data", "name" and "description" fields which are defined in an
xml -  

-- 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:template match="/">
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
			<fo:layout-master-set>
				<fo:simple-page-master master-name="simple"
				   page-height="29.7cm" 
				   page-width="21cm"
				   margin-top="1cm" 
				   margin-bottom="2cm" 
				   margin-left="2.5cm" 
				   margin-right="2.5cm">
					<fo:region-body margin-top="3cm"/>
					<fo:region-before extent="3cm"/>
					<fo:region-after extent="1.5cm"/>
				</fo:simple-page-master>
			</fo:layout-master-set>
			<fo:page-sequence master-reference="simple">
				<fo:flow flow-name="xsl-region-body">
					<xsl:apply-templates select="data"/>
				</fo:flow>
			</fo:page-sequence>
		</fo:root> 
	</xsl:template>
	<xsl:template match="data">
		<fo:block>
			<xsl:apply-templates select="name"/>
			<xsl:apply-templates select="description"/>
	       </fo:block>
	</xsl:template>
	<xsl:template match="name">       
		<fo:block font-size="18pt" 
		     font-family="sans-serif" 
		     line-height="24pt"
		     space-after.optimum="15pt"
		     background-color="blue"
		     color="white"
		     text-align="center"
		     padding-top="3pt">
			<xsl:value-of select="."/>
		</fo:block> 
	</xsl:template>
	<xsl:template match="description">
		<fo:block font-size="12pt" 
			 font-family="sans-serif" 
			 line-height="15pt"
			 space-after.optimum="3pt"
			 text-align="justify">
			<xsl:value-of select="."/>
		</fo:block>
	</xsl:template>
</xsl:stylesheet>

-- XML --

<?xml version="1.0" encoding="UTF-8" ?> 

<data>
	<name>
		Krusty the Clown
	</name> 
	<description>
		This memo explains why Krusty the Clown is our best
customer. We need to take good care of him from now onwards and make sure
that there are always enough bananas for his pet monkey.
	</description>
</data>

Please guide me thru this.

Regards,

Devavratt,
LionBridge Technologies Inc.,
Mumbai.
Tel - 91-22-56930202 Extn. 5276
Cell - 9819823379
devavrat.bagayat@lionbridge.com
www.lionbridge.com


                                            The biggest risk itself
is........ not taking one. 





Received on Tuesday, 21 September 2004 06:39:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:12 GMT