create multiple tables using a single XSL stylesheet?

Subject: create multiple tables using a single XSL stylesheet?
From: "Wielenga, Geertjan" <Geertjan.Wielenga@xxxxxxxxxxxxxxxx>
Date: Mon, 27 Mar 2000 19:15:05 +0200
Hi...

I want to output two tables. The first for source data which refers to a
room (e.g., a reception room) and the second for data from the same source
which refers to a person (e.g., an employee). Both categories are found
within the same XML source but need to be placed in separate tables. made an
attempt using the XSL below, but this fails... Help!

- Geertjan Wielenga



<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:template match="/">
		<html>
			<head>
				<title>Amsterdam Office List</title>
			</head>
			<body>
				<font color="red"><h1>Amsterdam Office
List</h1></font>
				<xsl:apply-templates/>
			</body>
		</html>	
	</xsl:template>		
	
	<xsl:template match ="LIST">
	
			<h2>Employee List</h2>
			
			
			<xsl:choose>
				<xsl:when test="LIST/EMPLOYEE/ITEM[1][.='a
room']">
					<table border="1"><font
color="green"></font>			
						<tr>
						<th>Department</th>
						<th>Room title</th>
						<th>Room number</th>
						<th>Phone</th>
						<th>Initials</th>
						</tr>
					</table>
				</xsl:when>
				<xsl:otherwise>
				<table border="1"><font
color="green"></font>
						<tr>
						<th>Department</th>
						<th>Surname</th>
						<th>First name</th>
						<th>Room number</th>
						<th>Phone</th>
						<th>Initials</th>
						</tr>
				</table>	
				</xsl:otherwise>
			</xsl:choose>			
					<xsl:apply-templates
select="EMPLOYEE">
						<xsl:sort select="ITEM[2]"/>
					</xsl:apply-templates>
	</xsl:template>		
		
	<xsl:template match="EMPLOYEE">
		<tr>
			<td><font color="red"><xsl:value-of
select="ITEM[6]"/></font></td>
			<td><font color="red"><xsl:value-of
select="ITEM[1]"/></font></td>
			<td><font color="red"><xsl:value-of
select="ITEM[2]"/></font></td>
			<td><font color="red"><xsl:value-of
select="ITEM[4]"/></font></td>
			<td><font color="red"><xsl:value-of
select="ITEM[3]"/></font></td>
			<td><font color="red"><xsl:value-of
select="ITEM[5]"/></font></td>
		</tr>	
	</xsl:template>

</xsl:stylesheet>


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


Current Thread