<?xml version="1.0"?>

<!-- the entity declaration below is apparently a bit of a hack, but it
works -->
<!DOCTYPE stylesheet [
<!ENTITY nbsp "<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform' disable-output-escaping='yes'>&amp;nbsp;</xsl:text>">
]>

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

<xsl:output
	method="html"
/>

<!-- load in the sidebar for the unit we are generating pages for -->
<xsl:include href="http://www.csse.monash.edu.au/courseware/cse5230/2004/xsl/cse5230-sidebar.xsl"/>

<!-- variables for locations of various things, to promote portability. It
should only be necessary to edit here -->
<xsl:variable name="base-url">http://www.csse.monash.edu.au/courseware/cse5230/2004</xsl:variable>
<xsl:variable name="base-xsl-url">http://www.csse.monash.edu.au/courseware/cse5230/2004/xsl</xsl:variable>


<!-- variables for colors -->
<xsl:variable name="toc-bgcolor">#4488FF</xsl:variable>
<xsl:variable name="toc-fgcolor">#EEEEEE</xsl:variable>
<xsl:variable name="toc-intro-fgcolor">#CCCCCC</xsl:variable>
<xsl:variable name="sidebar-bgcolor">#4488FF</xsl:variable>
<xsl:variable name="sidebar-fgcolor">#EEEEEE</xsl:variable>
<xsl:variable name="heading-fgcolor">#003366</xsl:variable>

<!-- a bunch of attribute sets for the various fonts used -->
<xsl:attribute-set name="page-title-font-attributes">
	<xsl:attribute name="face">HELVETICA, VERDANA, ARIAL</xsl:attribute>
	<xsl:attribute name="size">+3</xsl:attribute>
	<xsl:attribute name="color"><xsl:value-of select="$heading-fgcolor"/></xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="font-attributes">
	<xsl:attribute name="face">HELVETICA, VERDANA, ARIAL</xsl:attribute>
	<xsl:attribute name="size">-1</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="section-title-font-attributes">
	<xsl:attribute name="face">HELVETICA, VERDANA, ARIAL</xsl:attribute>
	<xsl:attribute name="size">+0</xsl:attribute>
	<xsl:attribute name="color"><xsl:value-of select="$heading-fgcolor"/></xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="toc-section-title-font-attributes">
	<xsl:attribute name="face">HELVETICA, VERDANA, ARIAL</xsl:attribute>
	<xsl:attribute name="size">-1</xsl:attribute>
	<xsl:attribute name="color"><xsl:value-of select="$toc-fgcolor"/></xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="toc-intro-font-attributes">
	<xsl:attribute name="face">HELVETICA, VERDANA, ARIAL</xsl:attribute>
	<xsl:attribute name="size">-1</xsl:attribute>
	<xsl:attribute name="color"><xsl:value-of select="$toc-intro-fgcolor"/></xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="sidebar-font-attributes">
	<xsl:attribute name="face">HELVETICA, VERDANA, ARIAL</xsl:attribute>
	<xsl:attribute name="size">-1</xsl:attribute>
	<xsl:attribute name="color"><xsl:value-of select="$sidebar-fgcolor"/></xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="footer-font-attributes">
	<xsl:attribute name="face">HELVETICA, VERDANA, ARIAL</xsl:attribute>
	<xsl:attribute name="size">-2</xsl:attribute>
</xsl:attribute-set>

<!-- set up a rule that passes undefined elements (i.e. raw HTML) straight
through -->
<xsl:template match="*">
	<xsl:element name="{name(.)}">
	<xsl:for-each select="@*">
		<xsl:attribute name="{name(.)}">
			<xsl:value-of select="."/>
		</xsl:attribute>
	</xsl:for-each>
	<xsl:apply-templates/>
	</xsl:element>
</xsl:template>

<!-- Now the document-specific rules -->

<!-- need to redefine the <A> tag for the whole tag to be on the same line -->
<xsl:template match="a | A">
	<xsl:element name="{name(.)}">
		<!-- copy through any attributes -->
		<xsl:for-each select="@*">
			<xsl:attribute name="{name(.)}">
				<xsl:value-of select="."/>
			</xsl:attribute>
		</xsl:for-each>
         <xsl:apply-templates/>
</xsl:element>
</xsl:template>

<!-- redefine the <CODE> tag to switch to Courier font-->
<xsl:template match="code | CODE">
	<FONT FACE="COURIER">
	<xsl:apply-templates/>
	</FONT>
</xsl:template>

<!-- redefine the <TD> and <TH> tags to ensure that the contents of table
cells is in the right font -->
<xsl:template match="td | TD | th | TH">
	<xsl:element name="{name(.)}">
		<!-- copy through any attributes -->
		<xsl:for-each select="@*">
			<xsl:attribute name="{name(.)}">
				<xsl:value-of select="."/>
			</xsl:attribute>
		</xsl:for-each>
		<!-- wrap up the contents in the desired font -->
		<FONT xsl:use-attribute-sets="font-attributes">
		<xsl:apply-templates/>
		</FONT>
	</xsl:element>
</xsl:template>

<!-- The master rule that wraps up the entire document -->
<xsl:template match="courseware-web-page">
	<HTML>

	<xsl:comment>
	This file was automatically generated from an XML source using an XSL
	stylesheet. Do NOT attempt to edit it. All changes will be lost.
	</xsl:comment>

	<xsl:comment>
	Note that accented character entities are not yet "properly" supported.
	</xsl:comment>

	<HEAD>

	<STYLE>
		A:hover{color:'#FF0000'}
	</STYLE>

	<TITLE>
		<xsl:apply-templates select="header-title"/>
		2004
	</TITLE>
	</HEAD>

	<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#400090">

<!--   B E G I N   H E A D E R   T A B L E  -->
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<!-- Monash Site-wide Navigation -->
	<tr bgcolor="#000066">
		<td width="99" align="left"><a href="http://www.monash.edu.au/"><img src="http://www.csse.monash.edu.au/images/mvim/monash/homev.gif" width="99" height="16" border="0" alt="[Monash Home]"/></a></td> 
		<td width="96" align="left"><a href="http://www.monash.edu.au/info/"><img src="http://www.csse.monash.edu.au/images/mvim/monash/infov.gif" width="96" height="16" border="0" alt="[Monash Info]"/></a></td>

		<td width="107" align="left"><a href="http://www.monash.edu.au/news/"><img src="http://www.csse.monash.edu.au/images/mvim/monash/newsv.gif" width="107" height="16" border="0" alt="[News and Events]"/></a></td>
		<td width="148" align="left"><a href="http://www.monash.edu.au/campuses/"><img src="http://www.csse.monash.edu.au/images/mvim/monash/campusesv.gif" width="148" height="16" border="0" alt="[Campuses and Faculties]"/></a></td>
		<td bgcolor="#003399" rowspan="2" width="150"> <div align="center"> <a href="http://www.monash.edu.au/"><img src="http://www.csse.monash.edu.au/images/mvim/monash/logov.gif" width="150" height="38" border="0" alt="[Monash University]"/></a></div></td>
	</tr>
                <!-- Site Title -->
     <tr align="left" bgcolor="#003399">
    	<td colspan="4" height="25" align="left"><a href="http://www.csse.monash.edu.au/"><img src="http://www.csse.monash.edu.au/images/mvim/csse/csse-titlevw.jpg" width="447" height="25" border="0" alt="School of Computer Science and Software   Engineering"/></a></td>
	 </tr>

 <!-- Site Navigation CSSE -->
    <tr>
        <td width="100%" colspan="5" background="/images/mvim/csse/navbg.jpg" height="15">
       		<table width="600" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td width="85"><a href="/about/"><img src="http://www.csse.monash.edu.au/images/mvim/csse/nav-about.png" alt="about" width="85" height="15" border="0"/></a></td>
                <td width="85"><a href="/courses/"><img src="http://www.csse.monash.edu.au/images/mvim/csse/nav-courses.png" alt="courses" width="85" height="15" border="0"/></a></td>
                <td width="85"><a href="/people/"><img src="http://www.csse.monash.edu.au/images/mvim/csse/nav-people.png" alt="People" width="85" height="15" border="0"/></a></td>
                <td width="85"><a href="/research/"><img src="http://www.csse.monash.edu.au/images/mvim/csse/nav-research.png" alt="research" width="85" height="15" border="0"/></a></td>
                <td width="85"><a href="/student/"><img src="http://www.csse.monash.edu.au/images/mvim/csse/nav-student.png" alt="student" width="85" height="15" border="0"/></a></td>
                <td width="85"><a href="/community/"><img src="http://www.csse.monash.edu.au/images/mvim/csse/nav-community.png" alt="community" width="85" height="15" border="0"/></a></td>
                <td width="86"><a href="/internal/"><img src="http://www.csse.monash.edu.au/images/mvim/csse/nav-internal.png" alt="internal" width="85" height="15" border="0"/></a></td>
            </tr>
        </table>
	</td>
    </tr>

 <!-- Internal Anchors -->
    <tr>
	<td width="100%" colspan="5" bgcolor="{$toc-bgcolor}">
		<FONT xsl:use-attribute-sets="toc-intro-font-attributes">
		<STRONG>
		In this page:&nbsp;&nbsp;&nbsp;&nbsp;
		</STRONG>
		</FONT>
		<xsl:apply-templates select="//section/title" mode="toc"/>
	</td>
    </tr>
</table>

<!--   E N D    H E A D E R    T A B L E   -->


<P>
<FONT xsl:use-attribute-sets="page-title-font-attributes">
<xsl:apply-templates select="page-title"/>
2004
</FONT>
</P>


		<!-- SIDEBAR AND BODY OF PAGE -->
		<TABLE CELLPADDING="5">
			<TR>
				<TD VALIGN="TOP">
				<!-- SIDEBAR -->
					<TABLE WIDTH="150" CELLPADDING="10">
						<xsl:call-template name="sidebar"/>
					</TABLE>
				</TD>
				<!-- BODY -->
				<TD VALIGN="TOP">
					<xsl:apply-templates select="body"/>
				</TD>
			</TR>
		</TABLE>
		<!-- END SIDEBAR AND BODY -->

		<CENTER>
		<P>
		</P>
		<P>
		<FONT xsl:use-attribute-sets="footer-font-attributes">
		Generated from XML source and an
		<A HREF="{$base-xsl-url}/courseware-web-page.xsl">XSL
		stylesheet</A>,
		using <A HREF="http://xmlsoft.org/XSLT/">xsltproc</A>
		<!-- embedded Javascript to output the last modification date -->
		<SCRIPT>
		<xsl:comment>
		Hide script from old browsers
		<xsl:text>
		lastmod = document.lastModified		// get string of last modified date
		lastmoddate = Date.parse(lastmod)	// convert modified string to date
		if(lastmoddate == 0){				// 1970 GMT)
		document.writeln("Last modified: Unknown")
		} else {
		document.writeln("Last modified: " + lastmod)
		}
		</xsl:text>
		// end script hiding from old browsers
		</xsl:comment>
		</SCRIPT>
		<!-- if a last-editor tag is defined, output a byline, linked to a
		mailto: tag if the email attribute is given -->
		<xsl:if test="last-editor">
			<BR/>
			By
			<xsl:choose>
				<xsl:when test="last-editor/@email">
					<xsl:element name="A">
						<xsl:attribute name="HREF">mailto:<xsl:value-of select="last-editor/@email"/></xsl:attribute>
						<xsl:value-of select="last-editor"/>
					</xsl:element>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="last-editor"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>
		</FONT>
		</P>
		</CENTER>
	<!--   B E G I N   F O O T E R   T A B L E  -->
<div align="center"> 
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr bgcolor="#000066">
        <td>
         <a href="http://www.csse.monash.edu.au/webgroup/"> <img src="http://www.csse.monash.edu.au/images/mvim/monash/fhelp.gif" width="69" height="16" border="0" alt="Help"/></a>
        </td>

        <td>
        <a href="http://www.csse.monash.edu.au/about/location/"> <img src="http://www.csse.monash.edu.au/images/mvim/monash/fcontacts.gif" width="129" height="16" border="0" alt="Contacts"/></a>
        </td>

        <td>
    <a href="http://www.csse.monash.edu.au/sitemap/"> <img src="http://www.csse.monash.edu.au/images/mvim/monash/fsitemap.gif" width="114" height="16" border="0" alt="Site Map"/></a>
        </td>

        <td>
        <a href="http://www.csse.monash.edu.au/people/"> <img src="http://www.csse.monash.edu.au/images/mvim/monash/fdirectory.gif" width="184" height="16" border="0" alt="Staff Directory"/></a>
        </td>

        <td>
    <a href="http://www.csse.monash.edu.au/search/"> <img src="http://www.csse.monash.edu.au/images/mvim/monash/fsearch.gif" width="103" height="16" border="0" alt="Search"/></a>
        </td>
</tr>
</table>
</div>
        <!--   E N D   F O O T E R   T A B L E  -->
	</BODY>
	</HTML>
</xsl:template>

<!-- need some empty rules to avoid the default rule -->
<xsl:template match="header-title | page-title | address | item | title">
	<xsl:apply-templates/>
</xsl:template>

<!-- everything other than the header information is in the body -->
<xsl:template match="body">
	<xsl:apply-templates/>
</xsl:template>

<!-- everything within contents should be wrapped up in a section, which
has an optional title, and three other possible child elements: itemize,
text and multicol. All these can occur multiple times, and they can be
nested. -->
<xsl:template match="section">
	<P>
	<xsl:apply-templates select="title"/>
	</P>
	<FONT xsl:use-attribute-sets="font-attributes">
	<xsl:apply-templates select="itemize|text|announcements"/>
	</FONT>
</xsl:template>

<xsl:template match="section/title">
	<xsl:element name="A">
		<xsl:attribute name="NAME">
			<xsl:if test="../@name">
				<xsl:value-of select="../@name"/>
			</xsl:if>
			<xsl:if test="not(../@name)">
				<xsl:value-of select="."/>
			</xsl:if>
		</xsl:attribute>
	</xsl:element>
	<FONT xsl:use-attribute-sets="section-title-font-attributes">
	<STRONG>
	<xsl:if test="@href">
		<A HREF="{@href}">
		<xsl:apply-templates/>
		</A>
	</xsl:if>
	<xsl:if test="not(@href)">
		<xsl:apply-templates/>
	</xsl:if>
	</STRONG>
	</FONT>
</xsl:template>
<xsl:template match="section/title" mode="toc">
	<xsl:if test="not(@notoc)">
		<xsl:element name="A">
			<xsl:attribute name="HREF"><xsl:if test="../@name">#<xsl:value-of select="../@name"/></xsl:if><xsl:if test="not(../@name)">#<xsl:value-of select="."/></xsl:if></xsl:attribute>
			<FONT xsl:use-attribute-sets="toc-section-title-font-attributes">
			<STRONG>
			<xsl:apply-templates/>
			</STRONG>
			</FONT>&nbsp;<IMG SRC="{$base-xsl-url}/nav-arrow.gif" BORDER="0"/>
		</xsl:element>
	</xsl:if>
</xsl:template>

<xsl:template match="section//text">
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="section//itemize">
	<UL>
		<xsl:apply-templates/>
	</UL>
</xsl:template>

<xsl:template match="itemize/item">
	<LI>
		<xsl:apply-templates/>
	</LI>
</xsl:template>

<xsl:template match="section//itemize/item/title">
	<B>
	<xsl:apply-templates/>
	</B>
	<BR/>
</xsl:template>

<!-- Announcements section. Probably only used on home page -->
<xsl:template match="announcements">
	<TABLE WIDTH="100%" BORDER="1">
	<xsl:apply-templates/>
	</TABLE>
</xsl:template>

<xsl:template match="announcement">
	<TR>
	<TD>
	<FONT xsl:use-attribute-sets="font-attributes">
	<xsl:value-of select="date"/>
	<xsl:if test="@newsflash">
		<BR/><BLINK><FONT COLOR="RED">Newsflash!</FONT></BLINK>
	</xsl:if>
	</FONT>
	</TD>
	<TD>
	<FONT xsl:use-attribute-sets="font-attributes">
	<xsl:apply-templates select="message"/>
	</FONT>
	</TD>
	</TR>
</xsl:template>

<xsl:template match="announcement/message">
	<xsl:apply-templates/>
</xsl:template>

<xsl:template name="sidebar-entry">
	<xsl:param name="title">Dummy</xsl:param> <!-- placeholder -->
	<xsl:param name="url">Dummy</xsl:param> <!-- placeholder -->
	<TR>
	<TD VALIGN="TOP" WIDTH = "140"  bgcolor="{$sidebar-bgcolor}">
	<A HREF="{$url}"><FONT
	xsl:use-attribute-sets="sidebar-font-attributes"><STRONG><xsl:value-of
	select="$title"/></STRONG></FONT></A>&nbsp;<IMG SRC="{$base-xsl-url}/nav-arrow.gif" BORDER="0"/>
	</TD>
	</TR>
</xsl:template>

</xsl:stylesheet>
