[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] table in html with exactly four columns in xsl


Subject: [xsl] table in html with exactly four columns in xsl
From: "Markus Hanel" <markus.hanel@xxxxxx>
Date: Thu, 25 Sep 2003 20:31:23 +0200 (MEST)

hallo,
I am a beginner with xml, and my problem is to create a table in html 
with rows and exactly 4 columns to number automatic a few forms. 
The last row should be filled up to 4 columns with empty cells or one cell
with "colspan".
this last row problem i could not solved!
many thanks!
markus

this should be the form!
test1  test2  test3  test4 
test5  test6  test7  test8 
test9  test10 test11 test12 
test13 empty  empty  empty
          cell       cell     cell


<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<?xml-stylesheet href="tabelle.xsl" type="text/xsl"?>
<!DOCTYPE interview SYSTEM "tabelle.dtd">
<interview>
<form>test1</form>
<form>test2</form>
<form>test3</form>
<form>test4</form>
<form>test5</form>
<form>test6</form>
<form>test7</form>
<form>test8</form>
<form>test9</form>
<form>test10</form>
<form>test11</form>
<form>test12</form>
<form>test13</form>
</interview>

with the xsl

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:param name="cols" select="4" />

<xsl:template match="interview">

<html>
<head>
<title>tabelle</title>
</head>
<body>
<table border="1">
  <xsl:apply-templates select="//form[position() mod $cols = 1]" mode="row"
/>
</table>
</body>
</html>
</xsl:template>

<xsl:template match="form" mode="row">
<tr>
  <xsl:apply-templates select=". |following-sibling::form[position() &lt;
$cols]" mode="cell" />
</tr>
</xsl:template>


<xsl:template match="form" mode="cell">
<td>
  <xsl:apply-templates />
</td>
</xsl:template>

</xsl:stylesheet>

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++


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



Current Thread
Keywords