Newer
Older
XML / modules / otago-specific.xml
<?xml version="1.0" encoding="utf-8"?>

<!--
	Elements, etc., that are specific to Otago.
-->

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


	<!--
		Format a University paper code. These normally appear in the form "SPOD 123", i.e., a space between the subject code and the paper number.
	-->
	<template name="paper" match="paper">
		<common>
			<xsl:apply-templates select="subject-code" />
			<xsl:text> </xsl:text>
			<xsl:apply-templates select="paper-number" />
		</common>
	</template>
	
	<template name="subject-code" match="paper/subject-code">
		<common><xsl:apply-templates /></common>
	</template>
		
	<template name="paper-number" match="paper/paper-number">
		<common><xsl:apply-templates /></common>
	</template>


	<!--
		Expand an Otago period code (e.g., "S1") into it's full equivalent (e.g., "Semester One").
		
		$period-code: The period code to be expanded.
		
		Returns: The expanded period string.
	-->
	<function name="infosci:expand-period-code" as="xs:string">
		<common>
			<xsl:param name="period-code" />
			
			<xsl:variable name="period-string">
				<xsl:choose>
					<xsl:when test="$period-code = 'SS'">
						<xsl:text>Summer School</xsl:text>
					</xsl:when>
					<xsl:when test="$period-code = 'S1'">
						<xsl:text>Semester One</xsl:text>
					</xsl:when>
					<xsl:when test="$period-code = 'S2'">
						<xsl:text>Semester Two</xsl:text>
					</xsl:when>
					<xsl:when test="$period-code = 'FY'">
						<xsl:text>Full Year</xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<xsl:message terminate="yes">
							<xsl:text>Unrecognised period code "</xsl:text>
							<xsl:value-of select="$period-code" />
							<xsl:text>".</xsl:text>
						</xsl:message>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>
			
			<xsl:sequence select="$period-string" />
		</common>
	</function>
	
		
</stylesheet>