<!--

By: Tomoko Okuno
Summer 2003
To: output a word list 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="/">
		<!--
 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 is a loop. This tag tells the parser, each time you encounter a "lexicon" tag, do everything contained in the xsl:for-each tag. 
				-->
				<xsl:for-each select="lexicon">
					<!-- insert html tags in output -->
					<br/>
					<span style="font-family:Arial Unicode MS;font-size:large; color:#666699; ">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'  This tells the parser, 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">
						<!--add html tags -->
						<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>
					<!-- This tag closes the loop. -->
					</xsl:for-each>
					<!-- html tags -->
					<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" width="500" border="1" bordercolor="#666699">
						<tr>
							<td align="center">
								<span style="font-family:Arial Unicode MS;color:#666699; ">
									<b>Form</b>
								</span>
							</td>
							<td align="center">
								<span style="font-family:Arial Unicode MS;color:#666699; ">
									<b>Part-of-Speech</b>
								</span>
							</td>
							<td align="center">
								<span style="font-family:Arial Unicode MS;color:#666699; ">
									<b>English Gloss</b>
								</span>
							</td>
							<td align="center">
							
							</td>
						</tr>
						<!--Each time you encounter a forms element, do what is contained within the tags.-->
						<xsl:for-each select="forms">
						<!--Each time you encounter a form element, do what is contained within the tags.-->
							<xsl:for-each select="form">
								<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>
											<!-- This closes the unanalyzedform loop -->	
											</xsl:for-each>
										<!-- This closes the linguisticform loop -->
										</xsl:for-each>
									</td>
									<td>
										<span style="font-family:Arial Unicode MS; ">&#160;</span>
										<!-- Each time you encounter a grammatical-relation element, do what is contained within the tags -->
										<xsl:for-each select="grammatical-relation">
											<!-- 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 the pos loop -->
											</xsl:for-each>
										<!-- close the 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">
													<em>
														<span style="font-family:Arial Unicode MS; color:#666699;">
															<!-- Output what is in the value attribute -->
															<xsl:value-of select="."/>
														</span>
													</em>
												<!-- close the value loop -->
												</xsl:for-each>
											<!-- close the if tag -->
											</xsl:if>
										<!-- close the gloss loop -->
										</xsl:for-each>
									</td>
									<td>
										<!-- 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">
											<!-- Output html code. The '.' contained within curly brackets inserts the value of the attribute inot the  html href tag -->
											<a href="{.}.html" target="_blank">
												<img src="more.gif" border="0"/>
											</a>
										<!-- close the id loop -->
										</xsl:for-each>
									</td>
								</tr>
							<!-- close the form loop -->
							</xsl:for-each>
						<!-- close the forms loop -->
						</xsl:for-each>
					</table>
				<!-- close the lexicon loop -->
				</xsl:for-each>
			</body>
		</html>
	<!-- close the template -->
	</xsl:template>
<!-- end the stylesheet -->
</xsl:stylesheet>

