﻿<?xml version="1.0" encoding="utf-8"?>
<!-- instructionalUnit.xsl -->

<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0">
	
<xsl:template match="/">
 
<html>

<head>
	<title>XSL Transformation on Nicole's XML file</title>
	<link rel="stylesheet" type="text/css" href="instructionalUnit.css" />
	
	<!-- uncomment this AFTER saving instructionalUnit.xsl and rename to instructionUnit_toc.xsl ! 
		instructionalUnit.xsl is your foundation 
		
			<style type="text/css">
			div#lsn0 {
				display: block;
				} 
			div#lsn1, div#lsn2, div#lsn3, div#lsn4, div#lsn5, div#lsn6, div#lsn7, div#lsn8, div#lsn9, div#lsn10 {
				display: none;
				}
			</style>
	-->

	<!-- script type="text/javascript" src="instructionalUnit.js"></script -->
</head>

<body>
			<!-- navigational system, to javascript
			<div id="chooseLesson">
				<fieldset>
					<legend>Quick Link:</legend>
					<form>
						<select
							id="selectLesson" name="selectLesson"
							onchange="selectionMade(this);">
								<optgroup label="sections">
									<option value="0">Table of Contents</option>
									<option value="1">1</option>
									<option value="2">2</option>
									<option value="3">3</option>
									<option value="4">4</option>
									<option value="5">5</option>
									<option value="6">6</option>
									<option value="7">7</option>
									<option value="8">8</option>
									<option value="9">9</option>
									<option value="10">10</option>
									<option value="all">{{ All Lessons }}</option>
								</optgroup>
								<optgroup label="links">
									<option value="http://iris.lib.virginia.edu/tibet/xml/show.php?xml=/tools/tibfonts.xml&amp;l=uva10928423419921">Tibetan Unicode font</option>
									<option value="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;item_id=DoulosSILfont">IPA Unicode font</option>
									<option value="http://www.tibetanportal.com/">Tibetan Portal</option>
									<option value="http://www.lhasaverbs.org/">Lhasa Verbs</option>
								</optgroup>
						</select>
					</form>
				</fieldset>
			</div -->
			<!-- end of navigational system -->
			
	<!-- navigation links -->
	<div class="navLinks">
		<a href="instructionalUnit.xml">Table of Contents</a>
		<a href="index.html">Help</a>
		<a href="http://www.carla.umn.edu/lctl/">CARLA site</a>
		<a href="http://www.tibetanportal.com/">Tibetan Portal</a>		
	</div>
	<!-- end of navigation links -->
	<!-- TABLE OF CONTENTS -->
	<div id="lsn0"> <!-- TOC is given name "lsn0" to make javascript easier -->
	<h1><xsl:value-of select="instructionalUnit/@title"/></h1>
	<h2><xsl:value-of select="instructionalUnit/@goal"/></h2>
	<h2>Table of Contents</h2>
		<table id="tblTOC" align="center">
			<xsl:for-each select="instructionalUnit/lesson">
			<tr>
				<xsl:variable name="whichLesson" select="@number"/>
				<td>
					<a href="instructionalUnit_lsn{$whichLesson}.xml">
						<img src="images/lesson{$whichLesson}thumbnail.jpg"/>
					</a>
				</td>
				<td>
					<a href="instructionalUnit_lsn{$whichLesson}.xml">
						Lesson <xsl:value-of select="@number"/>: 
						<xsl:value-of select="lessonTibetan"/><br/>
					</a>
					<xsl:value-of select="lessonGoal"/>
				</td>
			</tr>
			</xsl:for-each>
		</table>
		<h2><xsl:value-of select="instructionalUnit/@comments"/></h2>
	</div>
	<!-- end of table of contents -->

	<!-- HEADER of each lesson (title, photo, caption)-->
	<xsl:for-each select="instructionalUnit/lesson">	
		<xsl:variable name="WHICHLESSON" select="@number"/>
		<div id="lsn{$WHICHLESSON}">
		
			<h1>Lesson <xsl:value-of select="$WHICHLESSON"/></h1>
			<h2>Goal: <xsl:value-of select="lessonGoal"/></h2>
	
			<p>
				<a href="images/lesson{$WHICHLESSON}.jpg"
					title="click on the image for a larger version">
					<img src="images/lesson{$WHICHLESSON}resized.jpg"/>
				</a>
				<xsl:value-of select="rootPictureCaption"/>
			</p>
	<!-- end of HEADER -->
	
	<!-- deal with Chapter 1, sound changes -->
	<div class="lessonContent">
	<xsl:variable name="whichLesson" select="1"/> <!-- this applies only to lesson 1 -->
	<xsl:for-each select="termsChanges/soundChangeCategory">
	<xsl:variable name="whichSection" select="@number"/>
	<div class="soundChanges">
	<h2><xsl:value-of select="@title"/></h2>
	
	<xsl:for-each select="soundChange">
	<xsl:variable name="whichPart" select="@number"/>
	
	<table align="center">
		<caption>
			<span class="IPAfont">
				<xsl:value-of select="@what"/>
			</span>
			 -- 
			 <span class="tibFont">
				<xsl:value-of select="@whatTib"/>
			</span>
		</caption>
		<tr>
			<th>Tibetan</th>
			<th>IPA</th>
			<th>English</th>
		</tr>
		<xsl:for-each select="term">
			<tr>
				<td><span class="tibFont"><xsl:value-of select="termTib"/></span></td>
				<td class="IPAfont"><xsl:value-of select="termIpa"/></td>
				<td><xsl:value-of select="termEng"/></td>
			</tr>
		</xsl:for-each>
		<tr>
					<td class="playAudio" colspan="3">
						<a href="audio/lsnAudio{$whichLesson}_{$whichSection}_{$whichPart}.mp3">
							Play the audio
						</a>
					</td>
				</tr>
	</table>
	</xsl:for-each>
	</div>
	</xsl:for-each>
	</div>
	<!-- end of chapter one rules -->
	<!-- ========================================================================  -->
	<!-- start of general chapter template -->
	<xsl:for-each select="terms">
		<!-- Section I: terms -->
		<h2>Section: Terms</h2>
		<table align="center">
		<tr>
			<th>Tibetan</th>
			<th>English</th>			
		</tr>
		<xsl:for-each select="term">
			<tr class="term">
				<td><span class="tibFont"><xsl:value-of select="termTib"/></span></td>
				<td><xsl:value-of select="termEng"/></td>	
			</tr>
		</xsl:for-each>
		<tr>
					<td class="playAudio" colspan="2">
						<a href="audio/lsnAudio{$WHICHLESSON}_1_1.mp3">
							Play the audio
						</a>
					</td>
				</tr>
		</table>
	</xsl:for-each>
	
	<!-- Section II here -->
	<div class="pronFocus">
	<xsl:for-each select="PronFocus">
	<h2>Section: Pronunciation Focus</h2>
	<xsl:for-each select="Focus">
	<xsl:variable name="whichPart" select="@number"/>
		<table align="center">
		<caption>
			<xsl:value-of select="@what"/>
			 -- 
			<span class="tibFont"><xsl:value-of select="@whatTib"/></span>
		</caption>
			<tr>
				<th>Tibetan</th>
				<th>English</th>
			</tr>
			<xsl:for-each select="Ex">
				<tr>
					<td><span class="tibFont"><xsl:value-of select="ExTib"/></span></td>
					<td><xsl:value-of select="ExEng"/></td>
				</tr>
			</xsl:for-each>
			<xsl:for-each select="Explanation">
				<tr>
					<td colspan="2"><xsl:value-of select="."/></td>
				</tr>
			</xsl:for-each>
				<tr>
					<td class="playAudio" colspan="2">
						<a href="audio/lsnAudio{$WHICHLESSON}_2_{$whichPart}.mp3">
							Play the audio
						</a>
					</td>
				</tr>
		</table>
		<br/>
	</xsl:for-each>
	</xsl:for-each>
	</div>
	<!-- end of Section II: Pronunciation Focus -->
	<!-- Section III: grammar -->
	<div class="grammar">
	<xsl:for-each select="grammar">
	<h2>Section: Grammar</h2>
		<xsl:for-each select="grammarPoint">
			<xsl:variable name="whichPart" select="@number"/>
			<xsl:variable name="totNumOfCol" select="@numOfCol"/>
			<h2><xsl:value-of select="@what"/></h2>
			<table align="center">
				<tr>
				<xsl:for-each select="colHeadings/col">
					<th><xsl:value-of select="."/></th>
				</xsl:for-each>
				</tr>
				<xsl:for-each select="ex">
					<tr>
					<xsl:for-each select="column">
						<td><xsl:value-of select="."/></td>
					</xsl:for-each>
					</tr>
				</xsl:for-each>
				<xsl:if test="(../../@number='2') or (../../@number='3')"> <!-- not all lessons have audio in the grammar part -->
				<tr>
					<td class="playAudio" colspan="{$totNumOfCol}">
						<a href="audio/lsnAudio{$WHICHLESSON}_3_{$whichPart}.mp3">
							Play the audio
						</a>
					</td>
				</tr>
				</xsl:if>
			</table>
		</xsl:for-each>
	</xsl:for-each>
	</div>
	
	<!-- part IV: Practice recordings -->
	<xsl:for-each select="Practice">	
		<div class="practice">
		<h2>Section: Practice with Audio</h2>
		<xsl:for-each select="glossary">
		<h2>Glossary</h2>
			<table align="center" class="glossary">
				<tr>
					<th>Tibetan (Amdo)</th>
					<th>English</th>
				</tr>
				<xsl:for-each select="ex">
					<tr>
						<td><span class="tibFont"><xsl:value-of select="Amdo"/></span></td>
						<td><xsl:value-of select="Eng"/></td>
					</tr>
				</xsl:for-each>
			</table>
		</xsl:for-each>
	
		<xsl:for-each select="record">
		<xsl:variable name="whichPart" select="@number"/>
			<table align="center">
				<caption>Practice Set #<xsl:value-of select="@number"/></caption>
				<tr>
					<xsl:if test="@numOfSpeakers!='1'">
						<th>speaker</th>
					</xsl:if>
					<th>content</th>
				</tr>
				<xsl:for-each select="speaker">
				<xsl:variable name="WHO" select="@who"/>
				
					<tr class="{$WHO}">
						<xsl:if test="../@numOfSpeakers!='1'">
							<td><xsl:value-of select="@who"/></td>
						</xsl:if>	
						<td><xsl:value-of select="."/></td>
					</tr>
				</xsl:for-each>
			<tr>
					<td class="playAudio" colspan="2">
						<a href="audio/lsnAudio{$WHICHLESSON}_4_{$whichPart}.mp3">
							Play the audio
						</a>
					</td>
				</tr>
			</table>
		</xsl:for-each>
	</div>
	</xsl:for-each>
	<!-- end of section 4: Practice -->
	</div>
	</xsl:for-each>		
	<!-- navigation links -->
	<br />
	<div class="navLinks">
		<a href="instructionalUnit.xml">Table of Contents</a>
		<a href="index.html">Help</a>
		<a href="http://www.carla.umn.edu/lctl/">CARLA site</a>
		<a href="http://www.tibetanportal.com/">Tibetan Portal</a>		
	</div>
	<!-- end of navigation links -->
</body>
</html>

</xsl:template>
</xsl:stylesheet>