<!--

By: Tomoko Okuno
On: Summer 2003
To: output an learners dictionary based on the Biao-Min lexicon xml file

-->
<!-- This is a stylesheet -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:field="http://www.emeld.org/field/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!--
 This stylesheet outputs xhtml (which is a dialect of xml) in unicode. In fact, this line puts the xhtml strict doctype into the output file, namely <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
-->
<xsl:output method="xml" version="1.0" encoding="utf-8" omit-xml-declaration="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" media-type="text/xml" />
<!--
The xsl:template tag defines the start of a template. The match="/" attribute matches the template to the root (/) of the XML source document.
-->
	<xsl:template match="/">
		<!-- now we insert the html tags we want in the output. -->
		<html>
			<head>
				<title>Biao Mien Stylesheets</title>
				<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
			</head>
			<body>
				<!--the "lexicon" element is the root element in the xml file.  This tag says, each time you encounter a "lexicon" tag, do everything contained in the xsl:for-each tag. -->
				<xsl:for-each select="lexicon">
					<!-- html tags -->
					<br/>
					<span style="font-family:Arial Unicode MS;font-size:large;  color:#666699;font-weight:bold; ">Biao Min</span>&#160;
                 
					<br/>
					<span style="font-family:Arial Unicode MS;font-size:small;   color:#666699;">
						<b>Field Linguist:</b>
					</span>
					<!--  This is a loop.   The @ symbol means 'attribute'  Each time you encounter an "linguist" attribute (of the lexicon element)  in the xml file, do what is contained in the :xsl for-each tag. 
					-->
					<xsl:for-each select="@linguist">
						<span style="font-family:Arial Unicode MS;  color:#666699; ">
							<!--Output the value of the current node.  Since we are currently in the linguist attribute, the information contained in it will be output.-->
							<xsl:value-of select="."/>
						</span>
					<!-- close the loop -->
					</xsl:for-each>
					<br/>
					<br/><br/>
					<span style="font-family:Arial Unicode MS;color:#0033ff;font-size:11; ">
						Note: These demonstration sound files are not by a native speaker of Biao Min.
					</span>
					<br/><br/>
					<table align="left" border="1" bordercolor="#666699" width="775">
						<tr>
							<td align="center" colspan="2">
								<span style="font-family:Arial Unicode MS;font-weight:bold;color:#666699; ">Biao Min Word</span>
							</td>
							<td align="center">
								<span style="font-family:Arial Unicode MS;font-weight:bold;color:#666699; ">Part-of-Speech</span>
							</td>
							<td align="center" colspan="2">
								<span style="font-family:Arial Unicode MS;font-weight:bold;color:#666699; ">English Gloss</span>
							</td>
							<td align="center">
								<span style="font-family:Arial Unicode MS;font-weight:bold;color:#666699; ">Semantic Field</span>
							</td>
							<td align="center">
								<span style="font-family:Arial Unicode MS;font-weight:bold;color:#666699; ">More info</span>
							</td>
						</tr>
						<!--Each time you encounter a forms element, do what is contained within the tags.-->
						<xsl:for-each select="forms">
							<p>
								<!--Each time you encounter a form element, do what is contained within the tags.-->
								<xsl:for-each select="form">
									<!-- If the lang attribute of the form element equals Biao-jiao Mien then do what is contained within the tags. -->
									<xsl:if test="@lang='Biao-jiao Mien'">
										<tr>
											<td>
												<!--loop through each "linguisticform" element-->
												<xsl:for-each select="linguisticform">
												<!--loop through each "unanalyzedform" element-->
													<xsl:for-each select="unanalyzedform">
														<span style="font-family:Arial Unicode MS;font-weight:bold;color:red; ">
															<!--Output the value of the current node. We are currently in the "unanalyzedform" node, this will output its value -->
															<xsl:value-of select="."/>
														</span>
													<!-- close the unanalyzedform loop -->
													</xsl:for-each>
												<!-- close the linguisticform loop -->
												</xsl:for-each>
											</td>
											<td>
												<span style="font-family:Arial Unicode MS; ">&#160;</span>
												<span style="font-family:Arial Unicode MS; ">&#160;</span>
												<span style="font-family:Arial Unicode MS; ">&#160;</span>
												<!-- The current node is the form element. For each id attribute of the form element, -->
												<xsl:for-each select="@id">
													<!-- The '.' contained within curly brackets inserts the value of the attribute inot the  html href tag. -->
													<a href="sound/mp3/{.}.mp3">
														<img src="audio.gif" border="0"/>
													</a>
												<!-- close the id loop -->
												</xsl:for-each>
											</td>
											<td>
												<!-- Each time you encounter a grammatical-relation element, do what is contained within the tags. -->
												<xsl:for-each select="grammatical-relation">
													<span style="font-family:Arial Unicode MS;color:#666699;  ">&#160;</span>
													<!-- For each pos attribute, -->
													<xsl:for-each select="@pos">
														<span style="font-family:Arial Unicode MS;;color:#666699;  ">
															<!-- output the value of the pos attribute -->
															<xsl:value-of select="."/>
														</span>
													<!-- close pos loop -->
													</xsl:for-each>
												<!-- close grammatical-relation loop -->
												</xsl:for-each>
											</td>
											<td>
												<!-- For each gloss element, -->
												<xsl:for-each select="gloss">
													<!-- Test the lang attribute of the gloss element, if it is English, do what is contained within the tags. -->
													<xsl:if test="@lang='English'">
														<!-- For each value attribute of the glosss, -->
														<xsl:for-each select="@value">
															<span style="font-family:Arial Unicode MS;color:#666699;  ">
																<!-- output what is in the value attribute -->
																<xsl:value-of select="."/>
															</span>
														<!-- close value loop -->
														</xsl:for-each>
													<!-- close lang=english if -->
													</xsl:if>
												<!-- close gloss loop -->
												</xsl:for-each>
											</td>
											<td align="left">
												<!-- We have stepped back out, so the current node is the form element. For each id attribute of the form element, -->
												<xsl:for-each select="@id">
													<!-- The '.' contained within curly brackets inserts the value of the attribute inot the  html href tag .-->
													<a href="{.}.html" target="_blank">
														<img src="{.}.gif" border="0"/>
													</a>
												<!-- close id loop -->
												</xsl:for-each>
											</td>
											<td align="left">
												<!-- For each gloss element, -->
												<xsl:for-each select="gloss">
													<!-- for each semantic-field element -->
													<xsl:for-each select="semantic-field">
														<span style="font-family:Arial Unicode MS;color:#666699;  ">
															<!-- output the value -->
															<xsl:value-of select="."/>
														</span>
													<!-- close semantic-field loop -->
													</xsl:for-each>
												<!-- close gloss loop -->
												</xsl:for-each>
											</td>
											<td align="center">
												<!-- We have stepped back out, so the current node is the form element. For each id attribute of the form element, -->
												<xsl:for-each select="@id">
													<!-- The '.' contained within curly brackets inserts the value of the attribute inot the  html href tag. -->
													<a href="{.}.xml" target="_blank">
														<img src="more.gif" border="0"></img>
													</a>
												<!-- close id loop -->
												</xsl:for-each>
											</td>
										</tr>
									<!-- close lang if -->
									</xsl:if>
								<!-- close the form loop -->
								</xsl:for-each>
							</p>
						<!-- close the forms loop -->
						</xsl:for-each>
					</table>
					<br/>
					<br/>
				<!-- close the lexicon loop -->
				</xsl:for-each>
			</body>
		</html>
	<!-- close template -->
	</xsl:template>
<!-- end stylesheet -->
</xsl:stylesheet>
