Simple XML into HTML double (2 two) columns

F

Freddy Morel

My objective is to make a two columns table from an XML-data file. I do
not want to use XSL, so sorting and else is not important for the
moment.
I have this working in a table:
|-------------------------------|
| table heading OK |
|-------------------------------|
| R1-C1 | R1-C2 | R1-C3 | R1-C4 |
| R2-C1 | R2-C2 | R2-C3 | R2-C4 |
| R3-C1 | R3-C2 | R3-C3 | R3-C4 |.....

<!-- XML-FILE "datasource.xml" -->
<?xml version="1.0" encoding="iso-8859-1"?>
<thedata>
<projet>
<nom>R1-C1</nom>
<description>R1-C2</description>
<pilotes>R1-C3</pilotes>
<participants>R1-C4</participants>
</projet>
.....
<projet>
<nom>R3-C1</nom>
<description>R3-C2</description>
<pilotes>R3-C3</pilotes>
<participants>R3-C4</participants>
</projet>
</thedata>

<!-- HTML-FILE "index.html" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Market Cadres&copy: Réalisations</title>
</head>
<body>
<xml id="thedata" src="datasource.xml"></xml>
<table width="90%" datasrc="#thedata">
<thead>
<tr>
<th colspan="4">Projets achevés</td>
</tr>
<tr>
<th width="20%">Nom</th>
<th width="40%">Description</th>
<th width="15%">Pilote(s)</th>
<th width="25%">Participant(s)</th>
</tr>
</thead>
<tbody>
<tr>
<td><span datafld="nom"></span></td>
<td><span datafld="description"></span></td>
<td><span datafld="pilotes"></span></td>
<td><span datafld="participants"></span></td>
</tr>
</tbody>
</table>
</body>
</html>

***I want to create a table with two columns like this
|---------------------------------------------------|
| table heading OK |
|---------------------------------------------------|
| R1-C1 R1-C2 R1-C3 R1-C4 | R2-C1 R2-C2 R2-C3 R2-C4 |
|-------------------------|-------------------------|
| R3-C1 R3-C2 R3-C3 R3-C4 |.....
***I thought of using an extra node like:
<thedata>
<row>
<projet>
<nom>R1-C1</nom>
<description>R1-C2</description>
<pilotes>R1-C3</pilotes>
<participants>R1-C4</participants>
</projet>
<projet>
<nom>R2*-C1</nom>
<description>R2-C2</description>
<pilotes>R2-C3</pilotes>
<participants>R2-C4</participants>
</projet>
</row>
<row>
.....
</row>
</thedata>
***But I don't know how to reference the second project of the row in
the "<span datafld=''>" tag for filling correctly the second column. I
do get around concatenating the data of the <projet> tag into one column
using the <span datafld="nom">&nbsp<span datafld="descr">.....

Many thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top