Newer
Older
XML / format-master.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- This will mostly be a list of element names to match, along with the corresponding HTML and LaTeX handling XSLT code. -->
<stylesheet	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
			xmlns:xs="http://www.w3.org/2001/XMLSchema">

	<!--
		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).
	-->
	<include href="modules/global-elements.xml" />
	
	<!-- Output a string containing the date that the document was last built. -->
	<include href="modules/build-date.xml" />

	<!-- Basic page layout elements: paragraphs, page breask, etc. -->
	<include href="modules/basic-page-elements.xml" />

	<!-- Special characters. -->
	<include href="modules/special-characters.xml" />

	<!-- Greek characters. -->
	<include href="modules/greek-characters.xml" />

	<!-- Miscellaneous symbols. -->
	<include href="modules/miscellaneous-symbols.xml" />

	<!-- Emoticons. -->
	<include href="modules/emoticons.xml" />

	<!-- Mathematical operators and symbols. -->
	<include href="modules/mathematical-symbols.xml" />

	<!-- Relational algebra operators. -->
	<include href="modules/relational-algebra.xml" />

	<template name="LaTeX" match="LaTeX|latex">
		<common formats="/latex/xelatex/">{\LaTeX}</common>
		<common formats="/html/xhtml/">L<sup>A</sup>T<sub>E</sub>X</common>
	</template>

	<template name="LaTeX-strip" match="LaTeX|latex" mode="strip">
		<common formats="/html/xhtml/">LaTeX</common>
	</template>

	<!-- In-text "menus", e.g., for displaying things like Windows Start Menu items. -->
	<include href="modules/menus.xml" />

	<!-- Basic text formatting (emphasis, bold, etc.). -->
	<include href="modules/basic-text-formatting.xml" />

	<!-- Inline code and code blocks. -->
	<include href="modules/code-formatting.xml" />

	<!-- Fonts and typefaces. -->
	<include href="modules/fonts.xml" />
	
	<!-- Quoted text. -->
	<include href="modules/quotations.xml" />

	<!-- Lists (itemised, enumerated, definition). -->
	<include href="modules/lists.xml" />

	<!-- Obsolete items (in order to provide informative error messages). -->
	<include href="modules/obsolete.xml" />
	

	<!--
		Question text. This only exists so that we can ensure that appropriate
		<p> tags are correctly inserted. If this template didn't exist, showing
		the answers would generate invalid HTML. The answers are enclosed in a
		<div class="answer">...</div>. Without this template, the answer markup
		ends up embedded inside <p>...</p>, which is invalid.
	-->
	<template name="question" match="question">
		<common formats="/latex/xelatex/"><xsl:apply-templates /></common>
		<common formats="/html/xhtml/">
			<xsl:choose>
				<!--
					Check whether there are actual paragraphs inside the
					question. If so, let them worry about inserting the
					<p> tags.
				-->
				<xsl:when test="count(paragraph|para|p|question|answer|code-block) != 0">
					<xsl:apply-templates />
				</xsl:when>
				<!--
					Otherwise, insert <p> tags surrounding the question content.
				-->
				<xsl:otherwise>
					<p><xsl:apply-templates /></p>
				</xsl:otherwise>
			</xsl:choose>
		</common>
	</template>

	
	<!--
		Sample answers, which may optionally be excluded from the
		output. This can be done globally for all answers by setting the
		style sheet parameter $showanswers to "no", or it can be done
		locally on a question-by-question basis by setting the @hide
		attribute of the element to "yes".
		
		@hide: If "yes", don't include this answer in the output stream.
		The default is to include the answer.
	-->
	<template name="answer" match="answer">
		<common formats="/latex/xelatex/">
			<!--
				It's nice to weed out the sample answer markup at the XSLT processing stage to make LaTeX run faster.
				Note that \showanswers still needs to be called so that LaTeX can format chapter headings like "Answers for ..."
			-->
			<xsl:if test="$showanswers='yes'">
			\begin{answer}
				<xsl:apply-templates />
			\end{answer}

			</xsl:if>
		</common>
		<common formats="/html/xhtml/">
			<xsl:if test="$showanswers='yes'">
				<div class="answer">
					<xsl:apply-templates />
				</div>
			</xsl:if>
		</common>
	</template>
	
	<!--
		Match hidden answers and do nothing.
	-->
	<template name="hidden-answer" match="answer[@hide='yes']" />

	
	<!-- Footnotes. -->
	<include href="modules/footnotes.xml" />
	
	<!-- "Titling" elements, e.g., title, author, date. -->
	<include href="modules/titling.xml" />

	<!-- Sections, subsections, etc. -->
	<include href="modules/sectioning.xml" />
	
	<!-- Meta-elements. -->
	<include href="modules/meta-elements.xml" />
	
	<!-- Tabular structures (LaTeX {tabular}, HTML <table>). -->
	<include href="modules/tabular.xml" />
	
	<!-- Hyperlinks. -->
	<include href="modules/hyperlinks.xml" />

	<!-- Cross-references. -->
	<include href="modules/cross-references.xml" />
	
	<!-- "Floating" items such as figures and tables. -->
	<include href="modules/floaters.xml" />
	
	<!-- Images. -->
	<include href="modules/images.xml" />
	
	<!-- Include other documents. -->
	<include href="modules/inclusions.xml" />
	
	<!-- LaTeX-specific stuff. -->
	<include href="modules/latex.xml" />
	
	<!-- Embedding raw LaTeX or HTML code. -->
	<include href="modules/native-code.xml" />
	
	<!-- Conditional processing depending on the format. -->
	<include href="modules/conditional-processing.xml" />
		
	<!-- Mathematics. -->
	<include href="modules/maths.xml" />
	
	<!-- Otago-specific items. -->
	<include href="modules/otago-specific.xml" />
	
	<!-- Multi-column page layouts. -->
	<include href="modules/multi-column.xml" />
	
	<!-- Bibliographies and reference lists. -->
	<include href="modules/bibliography.xml" />
	
	<!-- Format numbers. -->
	<include href="modules/number-formatting.xml" />
	

</stylesheet>