I need to select attributes from my XML file and output the info into a table using XSL, need to output day name, instructor and class being taught, the problem is that I have multiple attirubtes within each group.
my XML:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="g4.xsl"?>
<schedule>
<student_info>
Vitaliy Berkovich 803-401-025
</student_info>
<info>
<day name ="Monday">
<Class name="Database Administration" Code="CPAN 315" Instructor="Paul Berger" Time="9:00-10:45" Location="E422">
</Class>
<Class name="Design Patterns and Software Testing" Code="CPAN 311" Instructor="Robert Robson" Time="10:50-12:35" Location="E417">
</Class>
<Class name="Requirements Analysis and Process Modelling(WI)" Code="CPAN 331" Instructor="Razieh Niazi" Time="2:30-4:15" Location="J129">
</Class>
</day>
<day name="Tuesday">
<Class name="XML" Code="CPAN 330" Instructor="Eric Dymond" Time="9:55-10:45" Location="E422">
</Class>
<Class name="Design Patterns and Software Testing" Code="CPAN 311" Instructor="Robert Robson" Time="10:50-12:35" Location="J132">
</Class>
<Class name="Android Programming" Code="CPAN 312" Instructor="Igor Pustylnick" Time="2:30-4:15" Location="E422">
</Class>
</day>
<day name="Wednesday">
<Class name="Open Source Programming" Code="CPAN 332" Instructor="Eric Dymond" Time="9:00-10:45" Location="E417">
</Class>
<Class name="Android Programming" Code="CPAN 312" Instructor="Igor Pustylnick" Time="11:45-1:30" Location="J132">
</Class>
<Class name="XML" Code="CPAN 330" Instructor="Eric Dymond" Time="1:35-3:20" Location="J132">
</Class>
</day>
<day name="Friday">
<Class name="Database Administration" Code="CPAN 315" Instructor="Paul Berger" Time="11:45-1:30" Location="J132">
</Class>
<Class name="Open Source Programming" Code="CPAN 332" Instructor="Eric Dymond" Time="1:35-3:20" Location="J132">
</Class>
<Class name="Requirements Analysis and Process Modelling(WI)" Code="CPAN 331" Instructor="Razieh Niazi" Time="4:20-6:05" Location="J130">
</Class>
</day>
</info>
</schedule>
my XSL: before it output only the days and 2 classes, now it won't work at all as I was messing around with it too much
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="info">
<html>
<head><title>Schedule</title>
</head>
<body>
<table width="100%" border="1">
<THEAD>
<TR>
<TD width="50%"><B>Day</B></TD>
<TD width="50%"><B>Instructor</B></TD>
<TD width="50%"><B>Class</B></TD>
</TR>
</THEAD>
<TBODY>
</TBODY>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="day">
<TR>
<TD width="25%"><xsl:sort select="@name" /></TD>
<TD width="25%"><xsl:value-of select="Class/@Instructor" /></TD>
<TD width="25%"><xsl:value-of select="Class/@name" /></TD>
</TR>
</xsl:template>
</xsl:stylesheet>