Subject: [xsl] table creation from xml From: Andreas Peter <info@xxxxxxxxxx> Date: Mon, 11 Jun 2007 14:58:47 +0200 |
I want to create a table with 3 columns and x rows. The contents of the table should be read from a xml file which looks like the following example:
<kursinfo> <referent>Vortrag mit Ekhard Woelbert</referent> <datum>Mi. 10.01.07</datum> <uhrzeit>19.30 - 21.00 Uhr</uhrzeit> <kursnr>Kurs-Nr: 1</kursnr> <beitrag>4,00 €</beitrag> <zusatz></zusatz> </kursinfo>
<referent> should be spanned by 3 columns (managed :-). <datum> (should be always in first column), <uhrzeit> (should be always in second), <kursnr> AND <beitrag> always in third column among each other. This structure should be flexible so if elements of <datum>, <uhrzeit>, <kursnr>, <beitrag> will be added, the table should grow. IB4ve written a xsl file, but it does not really work so far:
<xsl:template match="kursinfo"> <fo:block xsl:use-attribute-sets="kursinfo"> <fo:table width="{$table.width}" height="{$table.height}" table-layout="{$table.layout}">
<fo:table-body> <xsl:for-each select="referent"> <fo:table-row> <fo:table-cell number-columns-spanned="2" column-number="1"> <fo:block text-align="left">
<fo:inline font-weight="bold"> <xsl:value-of select="."/> </fo:inline> </fo:block> </fo:table-cell> </fo:table-row> </xsl:for-each>
<xsl:for-each select="test"> <fo:table-row> <fo:table-cell column-number="1" width="20mm"> <fo:block text-align="left"><xsl:value-of select="datum"/></fo:block> </fo:table-cell> <fo:table-cell column-number="2" width="30mm"> <fo:block text-align="left"><xsl:value-of select="uhrzeit"/></fo:block> </fo:table-cell> <fo:table-cell column-number="3" width="20mm"> <fo:block text-align="left"><xsl:value-of select="kursnr"/></fo:block> <fo:block text-align="left"><xsl:value-of select="beitrag"/></fo:block> </fo:table-cell> </fo:table-row> </xsl:for-each> </fo:table-body> </fo:table> </fo:block> </xsl:template>
Thanks a lot, Andreas
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XPath checksum testing, Jesper Tverskov | Thread | Re: [xsl] table creation from xml, Florent Georges |
[xsl] XPath checksum testing, Jesper Tverskov | Date | Re: [xsl] table creation from xml, Florent Georges |
Month |