<?xml version="1.0"?>
<xsl:stylesheet   version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- 
     Copyright (c) 2005. Ken Sall (xml@kensall.com).   All Rights Reserved.
-->
<xsl:output method="html" indent="yes" />

<xsl:variable name="PageTitle"><xsl:value-of select="/Collection/Concept[1]/scopeNote" /></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:element name="a"><xsl:attribute name="href"><xsl:value-of select="/Collection/Concept[1]/SOURCE"/></xsl:attribute><xsl:value-of select="$PageTitle" /></xsl:element></h1>
       <h3 align="center">Alphabetical sort by concept, including concepts in more than one category.</h3>
       <p align="center">Number of concepts (terms): <xsl:value-of select="count(/Collection/Concept)"/></p>
       <!-- Number of categories: <xsl:value-of select="count(/Collection/Concept/broader)"/> -->
       <p align="center">Jump to <a href="#part2">Alphabetical sort by broad category</a>.</p>
       
       <table align="center" cellpadding="1" cellspacing="2">
	<tr><th>Concept (Term)</th><th>Broader (Category)</th></tr>
        <xsl:apply-templates select="/Collection/Concept" >
          <xsl:sort order="ascending" select="." />  
        </xsl:apply-templates> 
       </table>
  
       <hr />
       <h3 align="center" id="part2" name="part2">Alphabetical sort by broad category.</h3>
        <p align="center">Links perform Google Uncle Sam search for the given concept.</p>
       <xsl:variable name="GoogleUncleSam">http://www.google.com/unclesam?hl=en&amp;q=</xsl:variable>
         
       <table align="center" cellpadding="2" cellspacing="3">
	<tr><th>Broader (Category)</th><th>Concept (Term)</th></tr>
	
         <xsl:for-each select="/Collection/Concept/broader">
	   <xsl:sort order="ascending"/>
	    <!-- Ideally, would like to count the number of terms in each category. -->
	    <xsl:variable name="term"><xsl:value-of select="../prefLabel" /></xsl:variable>
            <tr><td><b><xsl:value-of select="." /></b></td><td>
            <xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="concat($GoogleUncleSam, $term)" /></xsl:attribute><xsl:value-of select="$term"/></xsl:element></td></tr>
         </xsl:for-each>
      
       </table>
           
     <hr /><p style="font-size:75%; text-align:center">Copyright (c) 2005. <a href="mailto:xml@kensall.com">Ken Sall</a>.</p>
     </body>
   </html>
</xsl:template>

<xsl:template match="Concept">
   <xsl:variable name="term"><xsl:value-of select="prefLabel" /></xsl:variable>
   <tr><td><b><xsl:value-of select="$term" /></b></td>
   <td><xsl:value-of select="broader" /></td>
   <!--
   <td><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="SOURCE" /></xsl:attribute><xsl:value-of select="scopeNote" /></xsl:element></td>
   -->
  </tr>

</xsl:template> 

<!--
<xsl:value-of select="count([/Collection/Concept/prefLabel = $term])"/>
-->

</xsl:stylesheet>
