xsl-list
[Top] [All Lists]

[xsl] table creation from xml

2007-06-11 05:59:14
Hello xsl-list,

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 &#8364;</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. I´ve 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>

I would be very thankful for any hint which will solve my "problem".

Thanks a lot,
Andreas



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>