<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- Uses wordgloss pairs of word-level interlinearization to generate crude two-way glossaries.

Major flaw is that it displays every instance of such pairs, meaning that wordforms that occur multiple times in the text are repeated exactly that many times in the "glossary".

On the one hand, that's rather a unsightly feature for a glossary.  Likely readily fixed by anyone with more text-manipulation knowhow than myself, though, since it's just a question of suppressing multiple copies.

On the other hand, this same glitch rather visibly shows crude wordform frequencies...if the same were done with a morpheme-breakdown-plus-gloss pairs, can get a visual picture of word- and morpheme frequencies: useful for  prioritization in teaching vocabulary.

N.B.: also requires requires document structure for word-for-word interlinearization...not, unfortunately, automatic.-->


<xsl:template match="/">
<html>
<head>
<xsl:for-each select="collection">
<title><xsl:value-of select="title"/></title>
</xsl:for-each>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<font face="Arial Unicode MS, Gentium, Lucida Grande">
<xsl:for-each select="collection">
<h2><xsl:value-of select="title"/></h2>
</xsl:for-each>
<p></p>
<xsl:for-each select="collection/text">
<table border="0">
<tr bgcolor="salmon">
<th align="left" colspan="2"><xsl:value-of select="title"/></th>
</tr>
<tr>
<td>
<!--begin "CHEAP AND DIRTY" PENOBSCOT-ENGLISH GLOSSARY-->
<table border="1">
<tr bgcolor="maroon">
<th align="left">Target Language</th>
<th align="left">English</th>
</tr>
<xsl:for-each select="line/interlinearization/wordgloss">
<xsl:sort select="wordglossPB"/>
<tr>
<td><font face="Lucida Grande"><xsl:value-of select="wordglossPB"/></font></td>
<td><xsl:value-of select="wordglossEG"/></td>
</tr>
</xsl:for-each>
</table>
<!--end "CHEAP AND DIRTY" PENOBSCOT-ENGLISH GLOSSARY-->
<!--begin ALTERNATIVE "CHEAP AND DIRTY" ENGLISH-PENOBSCOT GLOSSARY-->
<table border="1">
<tr bgcolor="maroon">
<th align="left">English</th>
<th align="left">Target Language</th>
</tr>
<xsl:for-each select="line/interlinearization/wordgloss">
<xsl:sort select="wordglossEG"/>
<tr>
<td><xsl:value-of select="wordglossEG"/></td>
<td><font face="Lucida Grande"><xsl:value-of select="wordglossPB"/></font></td>
</tr>
</xsl:for-each>
</table>
<!--end ALTERNATIVE "CHEAP AND DIRTY" ENGLISH-PENOBSCOT GLOSSARY-->
</td>
</tr>
</table>
<br></br>
<br></br>
<br></br>
</xsl:for-each>
</font>
</body>
</html>
</xsl:template>
</xsl:stylesheet>