Problems displaying multiple instance of data

webmasterbeta

New Member
Using xslt to display an xml doc, with a few problems.

1 - One of the employees has 2 cell phone numbers, both need to be displayed. I can't figure out how.

2 - Some employees have multiple affiliations. The affiliations aren't showing up in the correct table sections.

3 - Employee affiliate "type" is showing when not being called.

XML:
<?xml version = "1.0" ?>
<?xml-stylesheet type="text/xsl" href=http://www.webdeveloper.com/forum/archive/index.php/"employee1.xsl"?>
<EmployeeList>

<Employee>
<EmployeeName>Max</EmployeeName>
<DOB>Apr 7, 1967</DOB>
<SSN>123-98-4567</SSN>
<HPhone>123-3232</HPhone>

<HAddress>
<Apt>Apt 8</Apt>
<Street>1239 W 99 ST</Street>
<City>Los Angeles</City>
<State>CA</State>
<Zip>90007</Zip>
</HAddress>

<CPhone>123-9876</CPhone>
<CPhone>123-9876</CPhone>

<Appointment>
<Affiliations>
<Dept>CS Dept</Dept>
<Title>Assistant Professor</Title>
<Type>Faculty</Type>
</Affiliations>
<OPhone>123-9982</OPhone>
<OAddress>CS-102</OAddress>
<OHrs>1:00-3:00Pm</OHrs>
</Appointment>

<Appointment>
<Affiliations>
<Dept>IMSC</Dept>
<Title>Assistant Professor</Title>
<Type>Faculty</Type>
</Affiliations>
<OPhone>232-2323</OPhone>
<OAddress>PH-998</OAddress>
<OHrs>3:00-4:00Pm</OHrs>
</Appointment>

<Appointment>
<Affiliations>
<Dept>ISI</Dept>
<Title>Assistant Professor</Title>
<Type>Faculty</Type>
</Affiliations>
<OPhone>232-5454</OPhone>
<OAddress>IS-834</OAddress>
<OHrs>4:00-5:00Pm</OHrs>
</Appointment>

</Employee>

<Employee>
<EmployeeName>Len</EmployeeName>
<DOB>Mar 7, 1978</DOB>
<SSN>123-67-4567</SSN>
<HPhone>444-2323</HPhone>

<HAddress>
<Apt>Apt 6</Apt>
<Street>4321 E 28 ST</Street>
<City>Los Angeles</City>
<State>CA</State>
<Zip>90008</Zip>
</HAddress>

<CPhone>434-8763</CPhone>

<Appointment>
<Affiliations>
<Dept>IMSC</Dept>
<Title>Assistant</Title>
<Type>Student</Type>
</Affiliations>
<OPhone>121-9875</OPhone>
<OAddress>PH-123</OAddress>
</Appointment>

</Employee>

<Employee>
<EmployeeName>Tom</EmployeeName>
<DOB>Jan 28, 1976</DOB>
<SSN>123-98-4567</SSN>
<HPhone>334-6565</HPhone>

<HAddress>
<Apt>Apt 5</Apt>
<Street>765 W 29 ST</Street>
<City>Los Angeles</City>
<State>CA</State>
<Zip>90008</Zip>
</HAddress>

<Appointment>
<Affiliations>
<Dept>CS Dept</Dept>
<Title>Assistant</Title>
<Type>Student</Type>
</Affiliations>
<OPhone>309-4543</OPhone>
<OAddress>CS-987</OAddress>
<OHrs>9:00-10:00Am</OHrs>
</Appointment>

</Employee>

<Employee>
<EmployeeName>Joe</EmployeeName>
<DOB>Dec 23, 1982</DOB>
<SSN>123-43-4567</SSN>
<HPhone>323-6543</HPhone>

<HAddress>
<Apt>Apt 4</Apt>
<Street>656 W 67 ST</Street>
<City>Los Angeles</City>
<State>CA</State>
<Zip>90067</Zip>
</HAddress>

<Appointment>
<Affiliations>
<Dept>CS Dept</Dept>
<Title>Half Assistant</Title>
<Type>Student</Type>
</Affiliations>
<OPhone>927-3423</OPhone>
<OAddress>CS-098</OAddress>
<OHrs>1:00-3:00Pm</OHrs>
</Appointment>

<Appointment>
<Affiliations>
<Dept>IMSC</Dept>
<Title>Half Assistant</Title>
<Type>student</Type>
</Affiliations>
<OPhone>343-4843</OPhone>
<OAddress>PH-543</OAddress>
</Appointment>

</Employee>

<Employee>
<EmployeeName>David</EmployeeName>
<DOB>Nov 12, 1978</DOB>
<SSN>123-96-4567</SSN>
<HPhone>665-8265</HPhone>

<HAddress>
<Apt>Apt 12</Apt>
<Street>678 W 76 ST</Street>
<City>Los Angeles</City>
<State>CA</State>
<Zip>90675</Zip>
</HAddress>

<CPhone>334-9876</CPhone>

<Appointment>
<Affiliations>
<Dept>IMSC</Dept>
<Title>Research Scientist</Title>
<Type>Staff</Type>
</Affiliations>
<OPhone>957-8324</OPhone>
<OAddress>PH-664</OAddress>
</Appointment>

</Employee>

<Employee>
<EmployeeName>Jerry</EmployeeName>
<DOB>Jul 12, 1965</DOB>
<SSN>123-76-4567</SSN>
<HPhone>232-5543</HPhone>

<HAddress>
<Apt>Apt 18</Apt>
<Street>6765 E 76 ST</Street>
<City>Los Angeles</City>
<State>CA</State>
<Zip>90675</Zip>
</HAddress>

<CPhone>443-9872</CPhone>

<Appointment>
<Affiliations>
<Dept>CS Dept</Dept>
<Title>Assistant Professor</Title>
<Type>Faculty</Type>
</Affiliations>
<OPhone>126-9876</OPhone>
<OAddress>CS-342</OAddress>
<OHrs>4:00-6:00Pm</OHrs>
</Appointment>

<Appointment>
<Affiliations>
<Dept>IMSC</Dept>
<Title>Assistant Professor</Title>
<Type>Faculty</Type>
</Affiliations>
<OPhone>987-6264</OPhone>
<OAddress>PH-546</OAddress>
<OHrs>3:00-4:00Pm</OHrs>
</Appointment>

</Employee>

<Employee>
<EmployeeName>Mary</EmployeeName>
<DOB>Apr 25, 1972</DOB>
<SSN>123-54-4567</SSN>
<HPhone>949-9986</HPhone>

<HAddress>
<Apt>Apt 56</Apt>
<Street>9879 W 7 ST</Street>
<City>Los Angeles</City>
<State>CA</State>
<Zip>90017</Zip>
</HAddress>

<Appointment>
<Affiliations>
<Dept>EE Dept</Dept>
<Title>Financial Officer</Title>
<Type>Staff</Type>
</Affiliations>
<OPhone>984-9872</OPhone>
<OAddress>EE-754</OAddress>
</Appointment>

<Appointment>
<Affiliations>
<Dept>IMSC</Dept>
<Title>Financial Officer</Title>
<Type>Staff</Type>
</Affiliations>
<OPhone>763-9343</OPhone>
<OAddress>PH-876</OAddress>
</Appointment>

</Employee>
</EmployeeList>


XSL:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">

<html>
<head>
<style type="text/css">
td.header {border: 1px solid Black; vertical-align: top; color: white;}
td.data {border: 1px solid Black; background-color: #EEEEEE; width: 10%; vertical-align: top;}
td.data2 {border: 1px solid Black; background-color: silver; width: 10%; vertical-align: top;}
</style>
</head>
<body>
<table style="width: 90%; border: 1px solid Black; background-color: green;" cellpadding="2"

cellspacing="0" align="center">
<tr style="text-align: center; font-weight: bold; font-family: Verdana; font-size: 12px;">
<td class="header">Name</td>
<td class="header">D.O.B.</td>
<td class="header">SSN</td>
<td class="header">H. Phone</td>
<td class="header">H. Address</td>
<td class="header">C. Phone</td>
<td class="header">Affiliations</td>
<td class="header">O. Phone</td>
<td class="header">O. Address</td>
<td class="header">O. Hours</td>
</tr>
<xsl:for-each select="EmployeeList/Employee">
<tr style="font-family: Verdana; font-size: 11px;">
<td class="data2"><xsl:value-of select="EmployeeName"/></td>
<td class="data"><xsl:value-of select="DOB"/></td>
<td class="data2"><xsl:value-of select="SSN"/></td>
<td class="data"><xsl:value-of select="HPhone"/></td>
<td class="data2"><xsl:value-of select="HAddress"/></td>
<td class="data"><xsl:value-of select="CPhone"/></td>
<td class="data2"><xsl:value-of select="Appointment/Affiliations"/></td>
<td class="data"><xsl:value-of select="Appointment/OPhone"/></td>
<td class="data2"><xsl:value-of select="Appointment/OAddress"/></td>
<td class="data"><xsl:value-of select="Appointment/OHrs"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Uploaded page:

<!-- m --><a class="postlink" href="http://www.ny-outdoors.com/for_school/employee.xml">http://www.ny-outdoors.com/for_school/employee.xml</a><!-- m -->

Thanks for any and all help.

Al
 
Back
Top