<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
	<HTML>
	<HEAD>
	<TITLE>Assignment p5</TITLE>
	<link rel="STYLESHEET" type="text/css" href="p5.css"/>
	</HEAD>
	<BODY>
	<H2>Homework Assignment</H2>
		
	<xsl:apply-templates select="classlist/department[@campus='R']">
		<xsl:sort select="name"/>
	</xsl:apply-templates>
	
	</BODY>
	</HTML>
</xsl:template>

<xsl:template match="department">
	<H3><xsl:value-of select="name"/></H3>
	
	<xsl:apply-templates select="../student[@major=current()/@id]">
		<xsl:sort select="name/last"/>
		<xsl:sort select="name/first"/>
	</xsl:apply-templates>
	
</xsl:template>

<xsl:template match="student">
    
		<li>
			<xsl:value-of select="name"/>-
			<xsl:value-of select="phone"/>
		</li>
	
</xsl:template>

</xsl:stylesheet>