<?xml version="1.0" encoding="UTF-8"?><!-- Version 2.3 --><!-- Hugh Sparks, March 26, 2005 --><!-- Configure the stylesheet --><xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="http://www.csparks.com/XMLWithoutTears" version="1.0">

<!-- The value for the "section" parameter is passed by the cocoon sitemap -->

<xsl:param name="section"/>

<!-- The "page" is the root element of the web page -->

	<xsl:template match="my:page">		
		<html>
		<xsl:comment>
		This document was automatically generated from an xml source.
		To see the original form, change the suffix in the browser
		from .xhtml to .XML and reload the page. "View source" will
		then show the orignal version.
		</xsl:comment>

		<head>

		<xsl:if test="@author">
			<meta name="author" content="{@author}"/>
		</xsl:if>
		<xsl:if test="@generator">
			<meta name="generator" content="{@generator}"/>
		</xsl:if>
		<xsl:if test="@description">
			<meta name="description" content="{@description}"/>
		</xsl:if>

		<title><xsl:value-of select="@name"/></title>

		<!-- <link rel="stylesheet" type="text/css" href="/stylesheet.css"/> -->
		<style>
		html {background-color: rgb(204,204,204)} 
		body {width: 17cm}
		p {margin-left:  2em ; margin-right: 2em}
		p.indent {margin-left: 4em ; margin-right: 4em}
		p.sub {font-style: italic ; margin-left: 2em ; margin-bottom: -0.5em ; color:#009}
		p.masthead {margin-left: 0; font-size: 9pt}
		h1 {color:#000054}
		h2 {color:#000054}
		h4 {color:#000054}
		img.sub {margin-left: 2em}
		
		ul.table {line-height: 130% ; list-style-type: none ; margin-top:0em; margin-left: 2em }

		ul.disk {margin-left: 2em; list-style-type:disk}
		li {margin-left: 1em}
	
		dl.def
		{	margin-left: 4em ;
			width: 40em ;
		}
		dt.term
		{	<!-- font-size: 18pt; -->
			height: 18pt ;
		} 
		dd.def
		{	position: relative ;
			margin-left: 4em ; 
			top:-16pt;
		}
		table.column {border: medium none; border-collapse: collapse}
		tr.column {border: medium none ; border-collapse:  collapse}
		td.column {border: medium none ; border-collapse: collapse}

		table.frame {border-collapse: collapse}
		tr.frame {}
		td.frame {border-style: solid; border-color: black; border-width: 1px; padding: 1mm}
		th.frame {}		
		tc.frame {}		

		#outer
		{	overflow: hidden;
			position: relative;
			height: 2cm ;
		}

		#outer[id]
		{	display: table;
			position: static;
		}

		#middle
		{	position: absolute;
			top: 50%;
		} /* Explorer only*/

		#middle[id]
		{	display: table-cell;
			vertical-align: middle;
			position: static;
		}

		#inner
		{	position: relative;
			top: -50%
		} /* Explorer only */

		.debug
		{	border-style: solid ;
			border-width: 1px ;
			border-color: rgb(255,0,0)
		}
		
		table.equation
		{	margin-left: 6em ;
		}
		
		td.equation
		{	width: 10cm ;
		}
		
		table.definition
		{	margin-left: 4em ;
		}
		
		td.definition
		{	width: 1.5cm ;
		}
		
		</style>
		
		</head>

		<body>
			<xsl:choose>
				<xsl:when test="$section">
					<xsl:apply-templates select="//my:page/my:s[@name=$section]"/>
				</xsl:when>
				<xsl:otherwise>
					<h2><xsl:value-of select="@name"/></h2>
					<xsl:call-template name="masthead"/>
					<xsl:apply-templates/>
				</xsl:otherwise>
			</xsl:choose>
		</body>
		
		</html>
	</xsl:template>

<!-- The optional masthead displays author, date, etc. -->

	<xsl:template name="masthead">
		<xsl:if test="@version or @date or @author or @url or @email">
		<p class="masthead"><i>
		<xsl:if test="@author and @email">
			<a>
				<xsl:attribute name="href">
					mailto:<xsl:value-of select="@email"/>
				</xsl:attribute>
				<xsl:value-of select="@author"/>
				<br/>
			</a>
		</xsl:if>
		<xsl:if test="@author and not(@email)">
			<xsl:value-of select="@author"/><br/>
		</xsl:if>
		<xsl:if test="not(@author) and @email">
			<a>
				<xsl:attribute name="href">
					mailto:<xsl:value-of select="@email"/>
				</xsl:attribute>
				<xsl:value-of select="@email"/>
				<br/>
			</a>
		</xsl:if>
		<xsl:if test="@version and @date">
			Version <xsl:value-of select="@version"/>
			<xsl:text>, </xsl:text>
			<xsl:value-of select="@date"/>
			<br/>
		</xsl:if>
		<xsl:if test="@version and not(@date)">
			<xsl:value-of select="@version"/>
			<br/>
		</xsl:if>
		<xsl:if test="not(@version) and @date">
			<xsl:value-of select="@date"/>
			<br/>
		</xsl:if>
		<xsl:if test="@url">
			<a href="{@url}">
				<xsl:value-of select="@url"/>
			</a><br/>
		</xsl:if>
		</i></p>
		</xsl:if>
	</xsl:template>


<!-- Sections are the main sub divisions of a page -->
 
	<xsl:template match="my:s">
		<h4 id="{@name}"><xsl:value-of select="@name"/></h4>
		<xsl:apply-templates/>
	</xsl:template>

<!-- "Ints" are introductory sections that don't go into the "contents" -->
 
	<xsl:template match="my:int">
		<h4><xsl:value-of select="@name"/></h4>
		<xsl:apply-templates/>
	</xsl:template>

<!-- Subsections -->

	<xsl:template match="my:ss">
		<p class="sub">
			<xsl:value-of select="@name"/>
		</p>
		<xsl:apply-templates/>
	</xsl:template>

<!-- Code is for displaying XML or other highly-punctuated text -->

	<xsl:template match="my:code" name="code">
		<pre><xsl:value-of select="."/></pre>
	</xsl:template>

<!-- Code subsections contain "code" -->

	<xsl:template match="my:sc">
		<p class="sub">
			<xsl:value-of select="@name"/>
		</p>
		<xsl:call-template name="code"/>
	</xsl:template>

<!-- Paragraphs are indented plain text -->

	<xsl:template match="my:p" name="p">
		<p>
		<xsl:if test="@indent">
			<xsl:attribute name="style">
				margin-left: <xsl:value-of select="@indent"/>em
			</xsl:attribute>
		</xsl:if>
		<xsl:if test="@size">
			<xsl:attribute name="style">
				font-size: <xsl:value-of select="@size"/>pt
			</xsl:attribute>
		</xsl:if>
		<xsl:apply-templates/>
		</p>
	</xsl:template>

<!-- Quotations -->

	<xsl:template match="my:quote">
		<p class="indent">
			<xsl:apply-templates/><br/>
			<i>-- <xsl:value-of select="@name"/></i>
		</p>
	</xsl:template>

<!-- Block quotes are simply indented paragraphs -->

	<xsl:template match="my:blockquote">
		<p class="indent">
			<xsl:apply-templates/>
		</p>
	</xsl:template>

<!-- Pictures -->

	<xsl:template match="my:picture">
		<center>
			<img src="{@url}"/><br/>
			<xsl:if test="@name">
				<i><xsl:value-of select="@name"/></i>
			</xsl:if>
		</center>
	</xsl:template>

<!-- Images without caption or centering -->

	<xsl:template match="my:image">
		<img>
			<xsl:attribute name="class">sub</xsl:attribute>
			<xsl:attribute name="src">
				<xsl:value-of select="@url"/>
			</xsl:attribute>
			<xsl:if test="@align">
				<xsl:attribute name="align">
					<xsl:value-of select="@align"/>
				</xsl:attribute>
			</xsl:if>
		</img>
	</xsl:template>

<!-- File names -->

	<xsl:template match="my:file">
		<i><xsl:apply-templates/></i>
	</xsl:template>

<!-- Italics -->

	<xsl:template match="my:i">
		<span>
			<xsl:if test="@size">
				<xsl:attribute name="style">font-size:<xsl:value-of select="@size"/>pt</xsl:attribute>
			</xsl:if>
			<i><xsl:apply-templates/></i>
		</span>
	</xsl:template>
	
<!-- Bold face -->

	<xsl:template match="my:b">
		<b><xsl:apply-templates/></b>
	</xsl:template>

<!-- Sub and superscripts -->

	<xsl:template match="my:sub">
		<sub><xsl:apply-templates/></sub>
	</xsl:template>

	<xsl:template match="my:sup">
		<sup><xsl:apply-templates/></sup>
	</xsl:template>

<!-- Inline code -->

	<xsl:template match="my:c">
		<code><xsl:apply-templates/></code>
	</xsl:template>
		
<!-- Line breaks -->

	<xsl:template match="my:cr">
		<br/>
	</xsl:template>

<!-- Inline links -->

	<xsl:template match="my:link" name="link">
		<xsl:choose>
			<!-- URLs are direct references -->
			<xsl:when test="@url">
				<a href="{@url}">
					<xsl:value-of select="@name"/>
				</a>
			</xsl:when>
			<!-- REF's are indirect references entries in the "references" section -->
			<xsl:when test="@ref">
				<xsl:variable name="target" select="@ref"/>
				<a>
					<xsl:attribute name="href">
						<xsl:value-of select="//my:references/my:def[@ref=$target]/@url"/>
					</xsl:attribute>
					<xsl:value-of select="@name"/>
				</a>
			</xsl:when>
			<!-- SEC's are links to other sections in this document -->
			<xsl:when test="@sec">
				<a href="#{@sec}">
					<xsl:value-of select="@name"/>
				</a>
			</xsl:when>
		</xsl:choose>
	</xsl:template>

<!-- Table of links -->

	<xsl:template match="my:links">
		<xsl:if test="@name">
			<h4><xsl:value-of select="@name"/></h4>
		</xsl:if>
		<ul class="table">
		<xsl:for-each select="my:link">
			<li><xsl:call-template name="link"/></li>
		</xsl:for-each>
		</ul>
	</xsl:template>

<!-- Table of Contents -->

	<xsl:template match="my:contents">
		<xsl:if test="@name">
			<h4><xsl:value-of select="@name"/></h4>
		</xsl:if>
		<ul class="table">
		<!-- Run through the whole document and get the section names -->
		<xsl:for-each select="//my:s">
			<li>
			<a href="#{@name}">
				<xsl:value-of select="@name"/>
			</a>
			</li>
		</xsl:for-each>
		<xsl:for-each select="//my:references">
			<li>
			<a href="#{@name}">
				<xsl:value-of select="@name"/>
			</a>
			</li>
		</xsl:for-each>
		</ul>
	</xsl:template>

<!-- References -->

	<xsl:template match="my:references">
		<xsl:if test="@name">
		<h4 id="{@name}"><xsl:value-of select="@name"/></h4>	
		<ul class="table">
		<xsl:for-each select="my:def">
			<li>
			<a href="{@url}">
				<xsl:value-of select="@name"/>
			</a>
			</li>
		</xsl:for-each>
		</ul>
		</xsl:if>
	</xsl:template>
			
<!-- Equation display using HotEqn -->

	<xsl:template match="my:hequation">
		<div style="margin-left:4em">
		<applet code="HotEqn.class" archive="http://www.csparks.com/NewHotEqn.jar" name="My Equation" width="{@width}" height="{@height}">
			<param name="bgcolor" value="CCCCCC"/>
			<param name="fontsize1" value="14"/>
			<param name="fontname" value="TimesRoman"/>
			<param name="equation">
				<xsl:attribute name="value">
					<xsl:value-of select="."/>
				</xsl:attribute>
			</param>
		</applet>
		</div>
	</xsl:template>

<!-- Multi-column layout -->

	<xsl:template match="my:columns">
		<table class="column" border="0" width="{@width}" cellpadding="10">
			<tr class="column">
				<xsl:apply-templates/>
			</tr>
		</table>
	</xsl:template>
	
	<xsl:template match="my:column">
		<td class="column" width="{@width}" valign="top">
			<xsl:apply-templates/>
		</td>
	</xsl:template>

<!-- Citations -->

	<xsl:template match="my:cite">
		<xsl:value-of select="@name"/>
		<i>
		<xsl:if test="@title">
			<xsl:text>, </xsl:text>
			<xsl:value-of select="@title"/>
		</xsl:if>
		</i>
		<xsl:if test="@pub">
			<xsl:text>, </xsl:text>
			<xsl:value-of select="@pub"/>
		</xsl:if>
		<xsl:if test="@date">
			<xsl:text>, </xsl:text>
			<xsl:value-of select="@date"/>
		</xsl:if>
		<xsl:if test="@page">
			<xsl:text>, </xsl:text>
			<xsl:value-of select="@page"/>
		</xsl:if>
		<xsl:text>.</xsl:text>
		<br/>
	</xsl:template>

<!-- Tables -->

	<xsl:template match="my:table">
		<center>
		<table class="frame">
			<xsl:apply-templates/>
		</table>
		</center>
	</xsl:template>
	
	<xsl:template match="my:tr">
		<tr class="frame"><xsl:apply-templates/></tr>
	</xsl:template>
	
	<xsl:template match="my:td">
		<td class="frame"><xsl:apply-templates/></td>
	</xsl:template>
	
	<xsl:template match="my:tc">
		<th class="frame" align="center"><xsl:apply-templates/></th>
	</xsl:template>
	
	<xsl:template match="my:th">
		<th class="frame" align="left"><xsl:apply-templates/></th>
	</xsl:template>

<!-- Lists -->

	<xsl:template match="my:ol">
		<ol><xsl:apply-templates/></ol>
	</xsl:template>
	
	<xsl:template match="my:ul">
		<ul><xsl:apply-templates/></ul>
	</xsl:template>	

	<xsl:template match="my:ulb">
		<ul class="disk"><xsl:apply-templates/></ul>
	</xsl:template>	

	<xsl:template match="my:li">
		<li><xsl:apply-templates/></li>
	</xsl:template>	

<!-- Image for jeuler equations -->

	<xsl:template match="my:jeuler">
		<img src="{@url}" alt="{@source}"/>
	</xsl:template>


	<xsl:template match="my:equation">
		<table class="equation">
		<tr>
		<td class="equation"><xsl:apply-templates/></td>
		<td>(<xsl:value-of select="@id"/>)</td>
		</tr>
		</table>
	</xsl:template>	

	<xsl:template match="my:def">
		<table class="definition">
		<tr>
		<td class="definition"><xsl:apply-templates select="my:name"/></td>
		<td><xsl:apply-templates select="my:value"/></td>
		</tr>
		</table>
	</xsl:template>	

</xsl:stylesheet>