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

<!--
	Various "global" elements that are frequently used across all documents. Some are passed in as arguments to the stylesheet (e.g., paper number), while others are things that don't change that often, and are thus hard coded (e.g., Oracle version).
	
	The "strip" mode forms of the templates are for use in the context of an HTML <title> element (so the mode is only relevant to the HTML formats). Embedding HTML markup inside the <title> element causes the markup to appear verbatim in the window title, i.e., <title><em>foo</em> bar</title> will appear in the window title as "<em>foo</em> bar", not "foo bar". Putting the stylesheet into strip mode means that it will only output text nodes unless otherwise specified for a particular element. Generally the "strip" templates will simply call-template to the original, unless the original contains markup that needs to be eliminated (e.g., see OracleServer below).
	
	The downside of this approach, of course, is that you need "strip" mode templates for quite a lot of things, but that can't really be helped.
-->

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

	<!--
		Subject code (e.g., "INFO").
	-->
	<template name="SubjectCode" match="SubjectCode">
		<common>
			<xsl:value-of select="$subject-code" />
		</common>
	</template>

	<template name="SubjectCode-strip" match="SubjectCode" mode="strip">
		<common formats="/html/xhtml/">
			<xsl:call-template name="SubjectCode" />
		</common>
	</template>

	<!--
		Paper number (e.g., "212").
	-->
	<template name="PaperNumber" match="PaperNumber">
		<common>
			<xsl:value-of select="$paper-number" />
		</common>
	</template>

	<template name="PaperNumber-strip" match="PaperNumber" mode="strip">
		<common formats="/html/xhtml/">
			<xsl:call-template name="PaperNumber" />
		</common>
	</template>

	<!--
		Complete paper code (e.g., "INFO 212").
	-->
	<template name="PaperCode" match="PaperCode">
		<common>
			<xsl:value-of select="$subject-code" />
			<xsl:text> </xsl:text>
			<xsl:value-of select="$paper-number" />
		</common>
	</template>

	<template name="PaperCode-strip" match="PaperCode" mode="strip">
		<common formats="/html/xhtml/">
			<xsl:call-template name="PaperCode" />
		</common>
	</template>
	
	<!--
		Year in which the paper is offered, plus or minus some offset.
		
		@offset: Output the year +/- some integer value. The input value is truncated and defaults to zero if not supplied.
	-->
	<template name="PaperYear" match="PaperYear">
		<common>
			<xsl:variable name="add">
				<xsl:value-of select="floor(@offset)" />
				<xsl:if test="not(@offset)">0</xsl:if>
			</xsl:variable>
			<xsl:value-of select="$paper-year + $add" />
		</common>
	</template>

	<template name="PaperYear-strip" match="PaperYear" mode="strip">
		<common formats="/html/xhtml/">
			<xsl:call-template name="PaperYear" />
		</common>
	</template>

	<!--
		Period in which a paper is offered (e.g., "Semester 2").
	-->
	<template name="PaperPeriod" match="PaperPeriod">
		<common>
			<xsl:value-of select="$paper-period" />
		</common>
	</template>

	<template name="PaperPeriod-strip" match="PaperPeriod" mode="strip">
		<common formats="/html/xhtml/">
			<xsl:call-template name="PaperPeriod" />
		</common>
	</template>

	<!--
		The name of the currently used Oracle server.
	-->
	<template name="OracleServer" match="OracleServer">
		<common formats="/latex/xelatex/">Oracle11\textit{g}</common>
		<common formats="/html/xhtml/">Oracle11<i>g</i></common>
	</template>

	<template name="OracleServer-strip" match="OracleServer" mode="strip">
		<common formats="/html/xhtml/">
			<xsl:text>Oracle11g</xsl:text>
		</common>
	</template>

	<!--
		The release number of the currently used Oracle server.
	-->
	<template name="OracleServerRelease" match="OracleServerRelease">
		<common>1</common>
	</template>

	<template name="OracleServerRelease-strip" match="OracleServerRelease" mode="strip">
		<common formats="/html/xhtml/">
			<xsl:call-template name="OracleServerRelease" />
		</common>
	</template>

	<!--
		The version number of the currently used Oracle server.
	-->
	<template name="OracleServerVersion" match="OracleServerVersion">
		<common>11.1</common>
	</template>

	<template name="OracleServerVersion-strip" match="OracleServerVersion" mode="strip">
		<common formats="/html/xhtml/">
			<xsl:call-template name="OracleServerVersion" />
		</common>
	</template>

	<!--
		A link to Blackboard.
	-->
	<template name="Blackboard" match="Blackboard">
		<common>
			<xsl:call-template name="hyperlink-internal">
				<xsl:with-param name="url">http://blackboard.otago.ac.nz/</xsl:with-param>
				<xsl:with-param name="label">Blackboard</xsl:with-param>
			</xsl:call-template>
		</common>
	</template>

	<template name="Blackboard-strip" match="Blackboard" mode="strip">
		<common formats="/html/xhtml/">
			<xsl:text>Blackboard</xsl:text>
		</common>
	</template>

</stylesheet>