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

[xsl] populating tables (long)


Subject: [xsl] populating tables (long)
From: k.weitzer@xxxxxx
Date: Fri, 9 Nov 2001 21:52:07 +0100

Question of populating a HTML - table:

given this XML - document:

<ROOT>
	<LEVEL_1 l1_attr="cell_content 1">
		<LEVEL_2 l2_attr="cell_content 1 1">
			<LEVEL_3 l3_attr="cell_content 1 1 1"/>
			<UNIQUE_LVL_2>some text 1 1</UNIQUE_LVL_2>
			<LEVEL_3 l3_attr="cell_content 1 1 2"/>
			<LEVEL_3 l3_attr="cell_content 1 1 3"/>
		</LEVEL_2>
	</LEVEL_1>
	<LEVEL_1 l1_attr="cell_content 2">
		<LEVEL_2 l2_attr="cell_content 2 1">
			<LEVEL_3 l3_attr="cell_content 2 1 1"/>
			<UNIQUE_LVL_2>some text 2 1</UNIQUE_LVL_2>
			<LEVEL_3 l3_attr="cell_content 2 1 2"/>
			<LEVEL_3 l3_attr="cell_content 2 1 3"/>
		</LEVEL_2>
		<LEVEL_2 l2_attr="cell_content 2 2 ">
			<LEVEL_3 l3_attr="cell_content 2 2 1"/>
			<UNIQUE_LVL_2>some text 2 2</UNIQUE_LVL_2>
			<LEVEL_3 l3_attr="cell_content 2 2 2"/>
			<LEVEL_3 l3_attr="cell_content 2 2 3"/>
		</LEVEL_2>
		<LEVEL_2 l2_attr="cell_content 2 3">
			<LEVEL_3 l3_attr="cell_content 2 3 1"/>
			<UNIQUE_LVL_2>some text 2 3</UNIQUE_LVL_2>
			<LEVEL_3 l3_attr="cell_content 2 3 2"/>
			<LEVEL_3 l3_attr="cell_content 2 3 3"/>
		</LEVEL_2>
	</LEVEL_1>
	<LEVEL_1 l1_attr="cell_content 3">
		<LEVEL_2 l2_attr="cell_content 3 1">
			<LEVEL_3 l3_attr="cell_content 3 1 1"/>
			<UNIQUE_LVL_2>some text 3 1</UNIQUE_LVL_2>
			<LEVEL_3 l3_attr="cell_content 3 1 2"/>
			<LEVEL_3 l3_attr="cell_content 3 1 3"/>
		</LEVEL_2>
		<LEVEL_2 l2_attr="cell_content 3 2">
			<LEVEL_3 l3_attr="cell_content 3 2 1"/>
			<UNIQUE_LVL_2>some text 3 2</UNIQUE_LVL_2>
		</LEVEL_2>
	</LEVEL_1>
...
</ROOT>

i have to generate a HTML - table like this:
<table border="1">
	<tr>
		<td rowspan="3">cell_content 1</td>
		<td rowspan="3">cell_content 1 1</td>
		<td rowspan="3">some text 1 1</td>
		<td>cell_content 1 1 1</td>
	</tr>
	<tr>
		<td>cell_content 1 1 2</td>
	</tr>
	<tr>
		<td>cell_content 1 1 3</td>
	</tr>
	<tr>
		<td rowspan="9">cell_content 2</td>
		<td rowspan="3">cell_content 2 1</td>
		<td rowspan="3">some text 2 1</td>
		<td>cell_content 2 1 1</td>
	</tr>
	<tr>
		<td>cell_content 2 1 2</td>
	</tr>
	<tr>
		<td>cell_content 2 1 3</td>
	</tr>
	<tr>
		<td rowspan="3">cell_content 2 2</td>
		<td rowspan="3">some text 2 2</td>
		<td>cell_content 2 2 1</td>
	</tr>
	<tr>
		<td>cell_content 2 2 2</td>
	</tr>
	<tr>
		<td>cell_content 2 2 3</td>
	</tr>
	<tr>
		<td rowspan="3">cell_content 2 3</td>
		<td rowspan="3">some text 2 3</td>
		<td>cell_content 2 3 1</td>
	</tr>
	<tr>
		<td>cell_content 2 3 2</td>
	</tr>
	<tr>
		<td>cell_content 2 3 3</td>
	</tr>
	<tr>
		<td rowspan="4">cell_content 3</td>
		<td rowspan="3">cell_content 3 1</td>
		<td rowspan="3">some text 3 1</td>
		<td>cell_content 3 1 1</td>
	</tr>
	<tr>
		<td>cell_content 3 1 2</td>
	</tr>
	<tr>
		<td>cell_content 3 1 3</td>
	</tr>
	<tr>
		<td>cell_content 3 2</td>
		<td>some text 3 2</td>
		<td>cell_content 3 2 1</td>
	</tr>
</table>

following conditions exists:
the number of levels is not known
each level consists at least of one empty element
ordering isn't necessary
rendering is done by msxml 3.0
each text and/or attribute node has to be a td

I have no clue how to do it, 'cause all my tries were
fruitless. Is it possible to design a generic stylesheet
which populates any table with any xml - document?
hope you can help
Klaus
____________________________________________________
Berufsunfähigskeitversicherung von Mamax bei WEB.DE. 
Jetzt informieren! http://bu.web.de


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



Current Thread
Keywords
xml