<?xml version="1.0"?>
<xsl:stylesheet   version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- 
     Copyright (c) 2005, 2008. Ken Sall (xml@kensall.com).   May be freely modified providing this copyright and comment line is left intact.
-->
<!-- 
     Modified April 25, 2008, by Owen Ambur with permission from Ken Sall.
-->
<xsl:output method="html" indent="yes" />

<xsl:variable name="PageTitle"><a href="http://xml.gov/stratml/index.htm">StratML</a> Glossary</xsl:variable> <!-- THIS LINE IS NOT GENERAL -->

<!-- Variables for uppercase to lowercase conversion, also to map underscore to space. Not presently used. -->
<xsl:variable name="ucase">ABCDEFGHIJKLMNOPQRSTUVWXYZ_</xsl:variable>
<xsl:variable name="lcase">abcdefghijklmnopqrstuvwxyz </xsl:variable>

<xsl:template match="/">
   <html>  
     <head>
       <title><xsl:value-of select="$PageTitle" /></title>
       <style type="text/css">
       body       { margin:2em; font-family: Arial; }
       </style>
     </head>
     <body>
       <h1 align="center"><xsl:value-of select="$PageTitle" /></h1>
       <h3 align="center">Alphabetically Sorted</h3>
       <ul style="margin-left:15em;">
       	<xsl:apply-templates select="/Collection/Concept" mode="pass1">
        	<xsl:sort order="ascending" select="." />
       	</xsl:apply-templates>
       </ul>
       <h3 align="center">In Order Commonly Occurring in StratML Documents</h3>
       <xsl:apply-templates select="/Collection/Concept" mode="pass2" />

     <hr /><p style="font-size:75%; text-align:center">XSLT Stylesheet and XML Schema Last Modified by <a href="mailto:Owen.Ambur@verizon.net">Owen Ambur</a>.</p>
     </body>
   </html>
</xsl:template>

<xsl:template match="Concept" mode="pass1" >
   	<xsl:variable name="term"><xsl:value-of select="prefLabel" /></xsl:variable>
	<li><a href="#{$term}"><xsl:value-of select="prefLabel" /></a></li>
</xsl:template> 

<xsl:template match="Concept" mode="pass2" >
   <xsl:variable name="term"><xsl:value-of select="prefLabel" /></xsl:variable>

   <table align="center" border="1" cellpadding="5" width="90%">
	<tr><td colspan="2">Concept: <b><a name="{$term}" id="{$term}"><xsl:value-of select="$term" /></a></b></td></tr>
	<tr><td>preferred term</td><td><xsl:value-of select="$term" /></td></tr>
	<xsl:for-each select="altLabel"> <!-- For repeatable elements, loop over all instances. Will output nothing if element is omitted completel.y -->
		<tr><td width="15%">alternate term</td><td><xsl:value-of select="." /></td></tr>
	</xsl:for-each>
	<xsl:if test="ABBREVIATION_OR_ACRONYM"><tr><td width="15%">abbreviation or acronym</td><td><xsl:value-of select="ABBREVIATION_OR_ACRONYM" /></td></tr></xsl:if>
	<xsl:if test="definition"><tr><td width="15%">definition</td><td><xsl:value-of select="definition" /></td></tr></xsl:if>
	<xsl:if test="subject"><tr><td width="15%">subject</td><td><xsl:value-of select="subject" /></td></tr></xsl:if>
	<xsl:if test="scopeNote"><tr><td width="15%">scope note</td><td><xsl:value-of select="scopeNote" /></td></tr></xsl:if>
	<xsl:if test="SOURCE"><tr><td width="15%">source</td><td><xsl:value-of select="SOURCE" /></td></tr></xsl:if>
	<xsl:if test="example"><tr><td width="15%">example</td><td><xsl:value-of select="example" /></td></tr></xsl:if>
	<xsl:if test="narrower"><tr><td width="15%">narrower</td><td><xsl:value-of select="narrower" /></td></tr></xsl:if>
	<xsl:if test="broader"><tr><td width="15%">broader</td><td><xsl:value-of select="broader" /></td></tr></xsl:if>
	<xsl:if test="related"><tr><td width="15%">related</td><td><xsl:value-of select="related" /></td></tr></xsl:if>
	<xsl:if test="changeNote"><tr><td width="15%">change note</td><td><xsl:value-of select="changeNote" /></td></tr></xsl:if>
	<xsl:if test="editorialNote"><tr><td width="15%">editorial note</td><td><xsl:value-of select="editorialNote" /></td></tr></xsl:if>
	<xsl:if test="REVIEW"> <!-- Note different processing for this nested complex type. Feel free to change the case of the labels, -->
		<xsl:if test="REVIEW/REVIEW_DATE"><tr><td width="15%">review date</td><td><xsl:value-of select="REVIEW/REVIEW_DATE" /></td></tr></xsl:if>
		<xsl:if test="REVIEW/REVIEW_STATUS"><tr><td width="15%">review status</td><td><xsl:value-of select="REVIEW/REVIEW_STATUS" /></td></tr></xsl:if>
		<xsl:if test="REVIEW/REVIEW_BODY"><tr><td width="15%">review body</td><td><xsl:value-of select="REVIEW/REVIEW_BODY" /></td></tr></xsl:if>
		<xsl:if test="REVIEW/REVIEW_CONTACT_NAME"><tr><td width="15%">review contact name</td><td><xsl:value-of select="REVIEW/REVIEW_CONTACT_NAME" /></td></tr></xsl:if>
		<xsl:if test="REVIEW/REVIEW_CONTACT_EMAIL"><tr><td width="15%">review contact email</td><td><xsl:value-of select="REVIEW/REVIEW_CONTACT_EMAIL" /></td></tr></xsl:if>
	</xsl:if>
   </table>
   <p></p>       
</xsl:template> 

</xsl:stylesheet>
<!-- Stylus Studio meta-information - (c) 2004-2007. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios/><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->