Newer
Older
XML / xml2html.xsl
cedwards on 7 Jan 2004 29 KB Added some to-dos and questions.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl-out:stylesheet xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl-out:strip-space elements="*"/><xsl-out:param name="department">INFO</xsl-out:param><xsl-out:param name="paper"/><xsl-out:output method="html" encoding="ISO-8859-1" media-type="text/html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/><xsl-out:template match="/document"><xsl-out:comment> THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! </xsl-out:comment><HTML><HEAD><LINK REL="Stylesheet" HREF="http://info-nts-05.otago.ac.nz/info321/styles.css" TYPE="text/css"/><TITLE><xsl-out:apply-templates select="title" mode="preamble"/></TITLE></HEAD><BODY><xsl-out:apply-templates/><HR/><ADDRESS><xsl-out:apply-templates select="copyright"/><xsl-out:apply-templates select="id/cvs-id"/></ADDRESS></BODY></HTML></xsl-out:template>
	

	<xsl-out:template name="PaperCode" match="PaperCode">
			<xsl:value-of select="$department" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
			<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;nbsp;</xsl:text>
			<xsl:value-of select="$paper" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
		</xsl-out:template>

	<xsl-out:template name="OracleServer" match="OracleServer">Oracle9<I xmlns:xsl="http://www.w3.org/1999/XSL/Transform">i</I></xsl-out:template>


	<xsl-out:template name="paragraph" match="paragraph"><P xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></P></xsl-out:template>
	<xsl-out:template name="para" match="para"><xsl-out:call-template name="paragraph"/></xsl-out:template>
	<xsl-out:template name="p" match="p"><xsl-out:call-template name="paragraph"/></xsl-out:template>
	
	
	
	
	<xsl-out:template name="newline" match="newline"><BR xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
	
	<xsl-out:template name="page-break" match="page-break"/>
	<xsl-out:template name="new-page" match="new-page"><xsl-out:call-template name="page-break"/></xsl-out:template>

	<xsl-out:template name="non-breaking-space" match="non-breaking-space"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;nbsp;</xsl:text></xsl-out:template>	
	<xsl-out:template name="nbsp" match="nbsp"><xsl-out:call-template name="non-breaking-space"/></xsl-out:template>

	
	<xsl-out:template name="ellipsis-sign" match="ellipsis-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8230;</xsl:text></xsl-out:template>
	<xsl-out:template name="etc" match="etc"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template>
	<xsl-out:template name="ellipsis" match="ellipsis"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template>
	<xsl-out:template name="dots" match="dots"><xsl-out:call-template name="ellipsis-sign"/></xsl-out:template>

	
	<xsl-out:template name="endash" match="endash"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8211;</xsl:text></xsl-out:template>
	<xsl-out:template name="en-dash" match="en-dash"><xsl-out:call-template name="endash"/></xsl-out:template>

	<xsl-out:template name="emdash" match="emdash"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8212;</xsl:text></xsl-out:template>
	<xsl-out:template name="em-dash" match="em-dash"><xsl-out:call-template name="emdash"/></xsl-out:template>

	<xsl-out:template name="apostrophe" match="apostrophe"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8217;</xsl:text></xsl-out:template>

	<xsl-out:template name="dollar" match="dollar">$</xsl-out:template>

	<xsl-out:template name="percent-sign" match="percent-sign">%</xsl-out:template>

	<xsl-out:template name="ampersand" match="ampersand"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;amp;</xsl:text></xsl-out:template>

	<xsl-out:template name="trademark-sign" match="trademark-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8482;</xsl:text></xsl-out:template>
	<xsl-out:template name="trademark" match="trademark"><xsl-out:call-template name="trademark-sign"/></xsl-out:template>
	<xsl-out:template name="TM" match="TM"><xsl-out:call-template name="trademark-sign"/></xsl-out:template>

	<xsl-out:template name="copyright-sign" match="copyright-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#169;</xsl:text></xsl-out:template>
	

	<xsl-out:template name="degree-sign" match="degree-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#176;</xsl:text></xsl-out:template>
	<xsl-out:template name="degrees" match="degrees"><xsl-out:call-template name="degree-sign"/></xsl-out:template>

	<xsl-out:template name="section-sign" match="section-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#167;</xsl:text></xsl-out:template>

	<xsl-out:template name="paragraph-sign" match="paragraph-sign"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#182;</xsl:text></xsl-out:template>

	
	
	<xsl-out:template name="pi" match="pi"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#960;</xsl:text></xsl-out:template>

	<xsl-out:template name="LaTeX" match="LaTeX">L<SUP xmlns:xsl="http://www.w3.org/1999/XSL/Transform">A</SUP>T<SUB xmlns:xsl="http://www.w3.org/1999/XSL/Transform">E</SUB>X</xsl-out:template>
	<xsl-out:template name="latex" match="latex"><xsl-out:call-template name="LaTeX"/></xsl-out:template>

	
	<xsl-out:template name="menu-separator" match="menu-separator"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8594;</xsl:text></xsl-out:template>
	<xsl-out:template name="menusep" match="menusep"><xsl-out:call-template name="menu-separator"/></xsl-out:template>

	<xsl-out:template name="menu-item" match="menu/item"><B xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></B></xsl-out:template>
	
	
	<xsl-out:template name="emph" match="emph"><EM xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></EM></xsl-out:template>
	<xsl-out:template name="italic" match="italic"><I xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template>
	<xsl-out:template name="strong" match="strong"><STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></STRONG></xsl-out:template>
	<xsl-out:template name="bold" match="bold"><B xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></B></xsl-out:template>
	<xsl-out:template name="term" match="term"><I CLASS="term" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template>
	<xsl-out:template name="foreign" match="foreign"><I CLASS="foreign" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template>
	<xsl-out:template name="code" match="code"><CODE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></CODE></xsl-out:template>

	
	<xsl-out:template name="code-block" match="code-block">
			<PRE CLASS="code" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></PRE>
		</xsl-out:template>

	
	<xsl-out:template name="verbatim" match="verbatim">
			<PRE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></PRE>
		</xsl-out:template>

	
	
	<xsl-out:template name="single-quote" match="quote[@single='yes']">
			<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8216;</xsl:text>
			<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
			<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8217;</xsl:text>
		</xsl-out:template>
	<xsl-out:template name="double-quote" match="quote">
			<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8220;</xsl:text>
			<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
			<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&amp;#8221;</xsl:text>
		</xsl-out:template>
	<xsl-out:template name="nested-double-quote" match="quote//quote">
			<xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:when test="(count(ancestor::quote) mod 2) = 0">
					<xsl:call-template name="double-quote"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:call-template name="single-quote"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl-out:template>
	<xsl-out:template name="nested-single-quote" match="quote[@single='yes']//quote" priority="2">
			<xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:when test="(count(ancestor::quote) mod 2) = 0">
					<xsl:call-template name="single-quote"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:call-template name="double-quote"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl-out:template>
	<xsl-out:template name="q" match="q"><xsl-out:call-template name="single-quote"/></xsl-out:template>
	<xsl-out:template name="qq" match="qq"><xsl-out:call-template name="double-quote"/></xsl-out:template>


	

	
	
	<xsl-out:template name="itemised-list" match="itemised-list">
			<UL xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:apply-templates/>
			</UL>
		</xsl-out:template>
	
	<xsl-out:template name="itemize" match="itemize"><xsl-out:call-template name="itemised-list"/></xsl-out:template>
	<xsl-out:template name="unordered-list" match="unordered-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template>
	<xsl-out:template name="bulleted-list" match="bulleted-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template>
	<xsl-out:template name="bullet-list" match="bullet-list"><xsl-out:call-template name="itemised-list"/></xsl-out:template>
	<xsl-out:template name="bullet-points" match="bullet-points"><xsl-out:call-template name="itemised-list"/></xsl-out:template>


	
	
	<xsl-out:template name="enumerated-list" match="enumerated-list">
			<OL xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:apply-templates/>
			</OL>
		</xsl-out:template>

	<xsl-out:template name="enumerate" match="enumerate"><xsl-out:call-template name="enumerated-list"/></xsl-out:template>
	<xsl-out:template name="ordered-list" match="ordered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template>
	<xsl-out:template name="numbered-list" match="numbered-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template>
	<xsl-out:template name="question-list" match="question-list"><xsl-out:call-template name="enumerated-list"/></xsl-out:template>
	
	
	
	<xsl-out:template name="definition-list" match="definition-list">
			<!--
				Hmm, <DL>s in HTML tend to come out with the spacing a
				bit wrong (or maybe it's just my browser?). Might using
				a table be better? Messy if the keyword is long,
				though, and you don't get a proper hanging indent...
				
				Maybe this is something thaty could be handled in CSS 
				instead.
			-->
			<DL xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:apply-templates/>
			</DL>
<!-- 			<TABLE BORDER="0" CELLPADDING="10"> -->
<!-- 				<xsl:apply-templates/> -->
<!-- 			</TABLE> -->
		</xsl-out:template>
	
	<xsl-out:template name="description-list" match="description-list"><xsl-out:call-template name="definition-list"/></xsl-out:template>


	
	<xsl-out:template name="item" match="item">
			<xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:when test="count(paragraph|para|p) != 0">
					<LI><xsl:apply-templates/></LI>
				</xsl:when>
				<xsl:otherwise>
					<LI><P><xsl:apply-templates/></P></LI>
				</xsl:otherwise>
			</xsl:choose>
		</xsl-out:template>

	<xsl-out:template name="definition-item" match="definition-list/item">
			<DT xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><P><xsl:apply-templates select="keyword"/></P></DT>
			<DD xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates select="definition|description|discourse"/></DD>
<!-- 			<TR VALIGN="TOP"> -->
<!-- 				<TD><P><xsl:apply-templates select="keyword"/></P></TD> -->
<!-- 				<TD><xsl:apply-templates select="definition|description|discourse"/></TD> -->
<!-- 			</TR> -->
		</xsl-out:template>
	
	<xsl-out:template name="keyword" match="keyword"><STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></STRONG></xsl-out:template>
	
	<xsl-out:template name="topic" match="topic"><xsl-out:call-template name="keyword"/></xsl-out:template>
	
	
	<xsl-out:template name="definition" match="item/definition|item/description|item/discourse">
			<xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:when test="count(paragraph|para|p) != 0">
					<xsl:apply-templates/>
				</xsl:when>
				<xsl:otherwise>
					<P><xsl:apply-templates/></P>
				</xsl:otherwise>
			</xsl:choose>
		</xsl-out:template>
	
	
	
	<xsl-out:template name="section" match="section">
			<xsl:if test="@label" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><A NAME="{@label}"/></xsl:if>
			<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
			<xsl:if test="count(.//footnote) &gt; 0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<P><STRONG>Notes:</STRONG></P>
				<xsl:apply-templates select=".//footnote" mode="list"/>
			</xsl:if>
		</xsl-out:template>
	
	
	
	<xsl-out:template name="footnote" match="footnote">
			<A xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:attribute name="NAME">
					<xsl:text>footnote-</xsl:text>
					<xsl:number level="any" count="footnote"/>
					<xsl:text>-source</xsl:text>
				</xsl:attribute>
				<xsl:attribute name="HREF">
					<xsl:text>#footnote-</xsl:text>
					<xsl:number level="any" count="footnote"/>
					<xsl:text>-target</xsl:text>
				</xsl:attribute>
				<xsl:text>[</xsl:text>
				<xsl:number level="any" count="footnote"/>
				<xsl:text>]</xsl:text>
			</A>
		</xsl-out:template>

	
	<xsl-out:template name="footnote-list" match="footnote" mode="list">
			<P xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<A>
					<xsl:attribute name="NAME">
						<xsl:text>footnote-</xsl:text>
						<xsl:number level="any" count="footnote"/>
						<xsl:text>-target</xsl:text>
					</xsl:attribute>
					<xsl:text>[</xsl:text>
					<xsl:number level="any" count="footnote"/>
					<xsl:text>]</xsl:text>
				</A>
				<xsl:text> </xsl:text>
				<xsl:apply-templates/>
				<xsl:text> </xsl:text>
				<A>
					<xsl:attribute name="HREF">
						<xsl:text>#footnote-</xsl:text>
						<xsl:number level="any" count="footnote"/>
						<xsl:text>-source</xsl:text>
					</xsl:attribute>
					<xsl:text>[Back]</xsl:text>
				</A>
			</P>
		</xsl-out:template>

	
	
	<xsl-out:template name="preamble-title" match="document/title" mode="preamble">
			<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
		</xsl-out:template>

	<xsl-out:template name="preamble-author" match="document/author" mode="preamble"/>

	<xsl-out:template name="preamble-date" match="document/date" mode="preamble"/>

	<xsl-out:template name="document-title" match="document/title">
			<H1 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></H1>
		</xsl-out:template>
	
	<xsl-out:template name="document-author" match="document/author"/>
	<xsl-out:template name="document-date" match="document/date"/>

	
	<xsl-out:template name="generate-subs"/>
	
	<xsl-out:template name="section-title" match="section/title">
			<xsl:variable name="depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:number value="1 + count(ancestor::section)"/>
				<xsl:if test="1 + count(ancestor::section) &gt; 6">6</xsl:if>
			</xsl:variable>
			<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&lt;H</xsl:text><xsl:number value="$depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&gt;</xsl:text>
			<xsl:number count="section" level="multiple" format="1.1.1.1.1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
			<xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:text>
			<xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
			<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&lt;/H</xsl:text><xsl:number value="$depth" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">&gt;</xsl:text>
		</xsl-out:template>


	
	<xsl-out:template name="quotation" match="quotation">
			<P xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:if test="@align">
					<xsl:attribute name="ALIGN">
						<xsl:value-of select="@align"/>
					</xsl:attribute>
				</xsl:if>
				<I><xsl:apply-templates/></I>
			</P>
		</xsl-out:template>
	
	
	
	<xsl-out:template name="id" match="id"/>
	
	
	
	<xsl-out:template name="omit" match="omit"/>

	
	
	<xsl-out:template name="comment" match="comment">
			<xsl:comment xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:apply-templates/>
			</xsl:comment>
		</xsl-out:template>
	
	
	
	<xsl-out:template name="tabular" match="tabular">
			<TABLE xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:attribute name="BORDER">
					<xsl:value-of select="@border"/>
					<xsl:if test="not(@border)">0</xsl:if>
				</xsl:attribute>
				<xsl:if test="@align">
					<xsl:attribute name="ALIGN">
						<xsl:value-of select="@align"/>
					</xsl:attribute>
				</xsl:if>
				<!--
					Note different ordering of tabular components:
					HTML requires THEAD and TFOOT to precede TBODY.
				-->
				<xsl:apply-templates select="tabular-header"/>
				<xsl:apply-templates select="tabular-footer"/>
				<xsl:apply-templates select="tabular-body"/>
			</TABLE>
		</xsl-out:template>
	
	
	<xsl-out:template name="aligned-column" match="column[@align]"/>
	
	<xsl-out:template name="unaligned-column" match="column[not(@align)]"/>
	
	<xsl-out:template name="tabular-header" match="tabular-header">
			<THEAD xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:apply-templates/>
			</THEAD>
		</xsl-out:template>

	<xsl-out:template name="tabular-footer" match="tabular-footer">
			<TFOOT xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:apply-templates/>
			</TFOOT>
		</xsl-out:template>

	<xsl-out:template name="tabular-body" match="tabular-body">
			<TBODY xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:apply-templates/>
			</TBODY>
		</xsl-out:template>

	<xsl-out:template name="row" match="row">
			<TR xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:apply-templates/>
			</TR>
		</xsl-out:template>

	<xsl-out:template name="row-rule-full" match="row-rule[not(@columns)]"/>

	<xsl-out:template name="row-rule-partial" match="row-rule[@columns]"/>
	
	<xsl-out:template match="cell" mode="multi-row"/>
	
	<xsl-out:template match="cell" mode="multi-column"/>
	
	<xsl-out:template match="cell">
			<!-- position() doesn't seem to work very well in this context -->
			<xsl:variable name="column-no" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:number/></xsl:variable>
		
			<TD xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:attribute name="ALIGN">
					<xsl:value-of select="@align"/>
					<xsl:if test="not(@align)">
						<xsl:value-of select="ancestor::tabular/columns/column[position() = $column-no]/@align"/>
						<xsl:if test="not(ancestor::tabular/columns/column[position() = $column-no]/@align)">left</xsl:if>
					</xsl:if>
				</xsl:attribute>
				<xsl:attribute name="COLSPAN">
					<xsl:value-of select="@columns"/>
					<xsl:if test="not(@columns)">1</xsl:if>
				</xsl:attribute>
				<xsl:attribute name="ROWSPAN">
					<xsl:value-of select="@rows"/>
					<xsl:if test="not(@rows)">1</xsl:if>
				</xsl:attribute>
				<xsl:apply-templates/>
			</TD>
		</xsl-out:template>
	
	
	
	<xsl-out:template name="hyperlink-label" match="hyperlink[@label]"><A HREF="#{@label}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></A></xsl-out:template>

	<xsl-out:template name="hyperlink-url" match="hyperlink[@url and node()]"><A HREF="{@url}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></A></xsl-out:template>

	
	<xsl-out:template name="empty-hyperlink-url" match="hyperlink[@url and not(node())]"><A HREF="{@url}" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><CODE><xsl:value-of select="@url"/></CODE></A></xsl-out:template>
	
	
	<xsl-out:template name="url" match="url"><CODE xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></CODE></xsl-out:template>
	
	<xsl-out:template name="uri" match="uri"><xsl-out:call-template name="url"/></xsl-out:template>
	<xsl-out:template name="email" match="email"><xsl-out:call-template name="url"/></xsl-out:template>
	<xsl-out:template name="email-address" match="email-address"><xsl-out:call-template name="url"/></xsl-out:template>


	
	<xsl-out:template name="reference" match="reference">
			<!-- Find the element whose label is the same as our label. -->
			<xsl:apply-templates select="//*[@label = current()/@label]" mode="reference" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
		</xsl-out:template>
	
	<xsl-out:template name="section-reference" match="section" mode="reference">
			<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Section&amp;#160;</xsl:text>
			<xsl:number count="figure" level="multiple" format="1.1.1.1.1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
		</xsl-out:template>
	
	<xsl-out:template name="figure-reference" match="figure" mode="reference">
			<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Figure&amp;#160;</xsl:text>
			<xsl:number count="figure" level="any" format="1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
		</xsl-out:template>
	
	<xsl-out:template name="table-reference" match="table" mode="reference">
			<xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Table&amp;#160;</xsl:text>
			<xsl:number count="table" level="any" format="1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
		</xsl-out:template>
	
	
	
	<xsl-out:template name="figure" match="figure">
			<DIV CLASS="figure" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:if test="@label"><A NAME="{@label}"/></xsl:if>
				<xsl:apply-templates select="*[not(self::caption)]"/>
				<xsl:if test="count(caption) != 0">
					<BR/>
					<xsl:apply-templates select="caption"/>
				</xsl:if>
			</DIV>
		</xsl-out:template>
	
	<xsl-out:template name="table" match="table">
			<DIV CLASS="table" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:if test="@label"><A NAME="{@label}"/></xsl:if>
				<xsl:apply-templates select="*[not(self::caption)]"/>
				<xsl:if test="count(caption) != 0">
					<BR/>
					<xsl:apply-templates select="caption"/>
				</xsl:if>
			</DIV>
		</xsl-out:template>
	
	<xsl-out:template name="figure-caption" match="figure/caption">
			<STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Figure <xsl:number count="figure" level="any" format="1"/>. </STRONG><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
		</xsl-out:template>
	
	<xsl-out:template name="table-caption" match="table/caption">
			<STRONG xmlns:xsl="http://www.w3.org/1999/XSL/Transform">Table <xsl:number count="table" level="any" format="1"/>. </STRONG><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
		</xsl-out:template>
	
	
	
	
	

	
	<xsl-out:template match="image" mode="latex"/>
	
	<xsl-out:template match="image[count(provide-large-version) = 0]">
			<IMG BORDER="0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:attribute name="SRC">
					<xsl:choose>
						<xsl:when test="(name(/child::node()[1])='tutorial') or (name(/child::node()[1])='laboratory')">
							<xsl:text>Graphics/</xsl:text>
							<xsl:value-of select="basename"/>
							<xsl:text>-72dpi.png</xsl:text>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>images/</xsl:text>
							<xsl:value-of select="basename"/>
							<xsl:text>.</xsl:text>
							<xsl:choose>
								<xsl:when test="count(format) != 0">
									<xsl:value-of select="format"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>png</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:attribute>
				<xsl:attribute name="ALT"><xsl:apply-templates select="description"/></xsl:attribute>
			</IMG>
		</xsl-out:template>

	<xsl-out:template match="image[count(provide-large-version) != 0]">
			<A xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				<xsl:attribute name="HREF">
					<xsl:text>images/</xsl:text>
					<xsl:value-of select="basename"/>
					<xsl:text>-zoom.</xsl:text>
					<xsl:choose>
						<xsl:when test="count(format) != 0">
							<xsl:value-of select="format"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>png</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:attribute>
				<IMG BORDER="0">
					<xsl:attribute name="SRC">
						<xsl:text>images/</xsl:text>
						<xsl:value-of select="basename"/>
						<xsl:text>.</xsl:text>
						<xsl:choose>
							<xsl:when test="count(format) != 0">
								<xsl:value-of select="format"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text>png</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:attribute>
					<xsl:attribute name="ALT">
						<xsl:apply-templates select="description"/>
					</xsl:attribute>
				</IMG>
				<BR CLEAR="right"/>
				<xsl:text>(Larger version)</xsl:text>
			</A>
		</xsl-out:template>
	
	
	
	<xsl-out:template name="include-xml" match="include-document">
			<xsl:apply-templates select="document(@file)" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
		</xsl-out:template>
	
	
	
	<xsl-out:template name="environment" match="environment[@file]"/>
	
	<xsl-out:template name="latex-package" match="latex-packages/package"/>
		
	<xsl-out:template name="latex-command" match="latex-packages/command"/>
	
	
	
	<xsl-out:template name="raw-latex" match="raw-code[@format = 'latex']"/>
		
	<xsl-out:template name="raw-html" match="raw-code[@format = 'html']"><xsl:copy-of select="*" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
		
	
	<xsl-out:template name="latex-input" match="latex-input"/>

	
	
	<xsl-out:template name="process-when-latex" match="process-when[@format = 'latex']"/>
	
	<xsl-out:template name="process-when-html" match="process-when[@format = 'html']"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
	
	
	
	<xsl-out:template name="math-inline" match="paragraph//math|para//math|p//math"><xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
	
	<xsl-out:template name="math-display" match="math"><P ALIGN="center" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></P></xsl-out:template>

	
	
	
	<xsl-out:template name="equation-array" match="equation-array">
			<TABLE CLASS="equation" BORDER="0" ALIGN="CENTER" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></TABLE>
		</xsl-out:template>


	
	
	<xsl-out:template match="equation-array/row">
			<TR xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><TD ALIGN="RIGHT"><xsl:apply-templates select="left"/></TD><TD ALIGN="CENTER"><xsl:apply-templates select="middle"/></TD><TD ALIGN="LEFT"><xsl:apply-templates select="right"/></TD></TR>
		</xsl-out:template>
	

	
	<xsl-out:template name="digit-group-separator" match="digit-group-separator">
			<xsl:call-template name="non-breaking-space" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
		</xsl-out:template>
	<xsl-out:template name="digitsep" match="digitsep"><xsl-out:call-template name="digit-group-separator"/></xsl-out:template>
	
	
	<xsl-out:template name="superscript" match="math//superscript"><SUP xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></SUP></xsl-out:template>
	
	<xsl-out:template name="subscript" match="math//subscript"><SUB xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></SUB></xsl-out:template>
	
	
	<xsl-out:template name="plus-operator" match="math//plus">+</xsl-out:template>
	
	<xsl-out:template name="minus-operator" match="math//minus">-</xsl-out:template>
	
	<xsl-out:template name="times-operator" match="math//times"><xsl:text disable-output-escaping="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> &amp;#215; </xsl:text></xsl-out:template>
	<xsl-out:template name="times" match="times"><xsl-out:call-template name="times-operator"/></xsl-out:template>
	
	<xsl-out:template name="divide-operator" match="math//divide">/</xsl-out:template>
	
	<xsl-out:template name="equals-operator" match="math//equals"> = </xsl-out:template>
	
	
	<xsl-out:template name="log-like-function" match="math//function"><xsl:value-of select="@name" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
	
	
	<xsl-out:template name="math-variable" match="math//variable"><I xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></I></xsl-out:template>
	
	
	<xsl-out:template name="math-fraction" match="math//fraction"><xsl:apply-templates select="numerator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/><BIG xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> / </BIG><xsl:apply-templates select="denominator" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></xsl-out:template>
	

</xsl-out:stylesheet>