<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <!--
    File: StreamNet_1Page.xsl  (originates from dfg_imaps2.xsl)

    Copyright (C) 2006, California Department of Fish and Game

    Author(s): Eric G. Miller - modified with permission by V.Hare, PSMFC GIS

    $Id: dfg_imaps2.xsl 1.9 2006/09/13 18:26:00 emiller Exp $

    Description: An XSLT transformation converting the complete CSDGM 1998 FGDC
    metadata, as well as extensions by ESRI (ESRI Profile).

    Design Goals: Make flexible; don't rely on JavaScript; standards compliant(see notes).

    Notes:  Not all ESRI profile elements are output. The /metadata/Esri section is
    ignored as are /metadata/Binary/Enclosures.  The /metadata/Binary/Thumbnail
    elements is handled the same as ESRI stylesheets where a preprocessing step
    must convert the Data element to an img element that references and external
    file.

    If a special element named "link" is present anywhere, it is converted to
    an "a" element in the output.  So, if a preprocessing step looks for things
    that look like URL's in the text of the metadata and converts those URL's
    to <link href="[url]">[url]</link>, they will be output as anchor links.

    If the stylesheet is called with the parameters entity and field, an attempt
    will be made to output only the "attr" section of the metadata where the
    entity variable equals the "enttypl" element text and the field variable
    equals the "attrlabl" element text.

    The template "br-replace" relies on the xsl processor handling entity
    references for newlines in a variable.  This is known to work with the
    MSXML 4 processor but to fail with the GNOME libxslt which requires a
    literal newline (which fails with MSXML!).

    $Log: dfg_imaps2.xsl $
    Revision 1.9  2006/09/13 18:26:00  emiller
    Fix typo ptcontact/ptcontac
    Fix issue with nested lworkcit (needs better formatting still)

    Revision 1.8  2006/08/24 19:59:29  emiller
    Added support for the Biological Profile (NBII)
    Other small modifications

    Revision 1.7  2006/08/21 22:13:50  emiller
    minor edit for field_metadata formatting

    Revision 1.6  2006/08/21 21:51:12  emiller
    Major revision:
    Eliminate table of contents, tons of reformatting.
    Approximates standard FGDC look, but better looking,
    more readable and more compact.

    Revision 1.5  2006/07/17 22:43:29  emiller
    Fix color/height/overflow for heading with metadata field section

    Revision 1.4  2006/07/13 22:44:26  emiller
    minor cleanups, release version

    Revision 1.3  2006/07/13 22:32:03  emiller
    Remove ms:string-compare() dependency.  Changed color scheme

    Revision 1.2  2006/07/13 20:54:37  emiller
    Bug fixes.  Add JavaScript for IE resize compatibility.

    Revision 1.1  2006/07/12 23:14:40  emiller
    Initial revision

  -->

  <xsl:output method="html"
        cdata-section-elements="script style"
        omit-xml-declaration="yes"
        doctype-public="-//W3C//DTD HTML 4.01 Strict//EN"
        doctype-system="http://www.w3.org/TR/html4/strict.dtd"
        encoding="us-ascii"
        />

  <!--
    These are required for output matching when just querying a field definition
    entity == table, field == column
  -->
  <xsl:param name="entity"/>
  <xsl:param name="field"/>

  <xsl:strip-space elements="*" />

  <xsl:template match="/">
    <html>
      <head>
        <title>Metadata</title>
        <meta name="Copyright" content="Copyright (c) 2006 California Department of Fish and Game"/>
        <meta name="Author" content="XSLT Authored by Eric G. Miller" />
        <meta name="Generator" content="dfg_imaps2.xsl" />
        <style type="text/css">
<![CDATA[
html, body, form, table {
   margin: 0px;
   padding: 0px;
   font-family: Verdana, Arial, sans-serif;
   font-size: 11px;
}

body {
   background-color: white;
}

h1, h2 {
   margin: 1ex 0px;
   font-size: larger;
   text-align: center;
   color: #384433;
}

img {
   margin: 1ex 0px;
   border: 1px solid #CBDAB4;
}

#heading {
   height: auto;
   padding: 0.25ex 0px;
   top: 0px;
   background-color: #F0F2E8;
   border-bottom: 1px solid #5F6C4B;
}

#heading2 {
  height: auto;
  padding: 0.25ex 0px;
   background-color: #F0F2E8;
   border-bottom: 1px solid #5F6C4B;
}

a:visited, a:link {
   color: rgb(0,68,127);
   text-decoration: none;
}

a:hover {
   text-decoration: underline;
}

.topleveldiv {
  margin: 0px;
  padding: 0px;
  border-bottom: 2px solid #CBDAB4;
  margin-bottom: 10px;
}

.bodydiv {
   padding-left: 20px;
}

.labl {
   color: #384433;
   font-weight: bold;
}

.sectdiv {
  margin-bottom: 10px;
}

.content {
   margin-left: 20px;
}

.content2 {
  margin-left: 20px;
  margin-bottom: 10px;
}
.tbl {
   border-collapse: collapse;
   border: 1px solid #CBDAB4;
   margin: 1ex 0px;
}
.tbl2 {
  border-collapse: collapse;
  border: 1px solid #CBDAB4;
  margin: 0px;
}

.tbl td, .tbl th, .tbl2 td, .tbl2 th {
   padding: 0.3ex;
   text-align: left;
   vertical-align: top;
   border: 1px solid #CBDAB4;
}

.tbl th, .tbl2 th {
   background-color: #F0F2E8;
   color: #384433;
}

@media print {
  body { background-color: white; color: black;}
  a:link, a:visited { color: blue; }
  #heading, #heading2 { background-color: white; border: none;}
  .labl, h1, h2 { color: black; }
  .tbl th { background-color: white; color: black; }
  .tbl, .tbl th, .tbl td, img { border-color: gray; }
}
        ]]>
        </style>
        <script type="text/javascript"><![CDATA[
function formatDate(dateStr)
{
  // If it looks like a metadata date, format it, otherwise just output it
  var re = /^(\d{4})(\d{2})?(\d{2})?$/;
  var parts = re.exec(dateStr);
  var result = dateStr;
  if (parts) {
    result = "";
    var cnt = 0;
    for (var i = 1; i < parts.length; i++)
    {
      if (!parts[i]) continue;
      if (cnt > 0) { result += "-"; }
      result += parts[i];
      cnt++;
    }
  }
  document.write(result);
}
function formatTime(timeStr)
{
  var re = /^(\d{2})(\d{2})(\d{2})?(\d{0,})?([-+Z])?(\d{4})?$/;
  var parts = re.exec(timeStr);
  var result = timeStr;
  if (parts) {
    result = parts[1] + ":" + parts[2];
    if (parts[3]) result += ":" + parts[3];
    if (parts[3] && parts[4]) result += "." + parts[4];
    if (parts[5]) {
      if (parts[5] == "Z") result += " (UTC)";
      else if (parts[6]) result += parts[5] + parts[6];
    }
    else {
      result += " (local time)";
    }
  }
  document.write(result);
}
        ]]></script>
      </head>
      <body>
        <xsl:choose>
          <xsl:when test="metadata != '' and $entity != '' and $field != ''">
            <xsl:call-template name="field_metadata" />
          </xsl:when>
          <xsl:when test="metadata != ''">
            <xsl:apply-templates select="metadata" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="bum_call" />
          </xsl:otherwise>
        </xsl:choose>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="metadata">
    <div id="heading">
      <h1>
        <xsl:value-of select="idinfo/citation/citeinfo/title"/>
      </h1>
    </div>
    <xsl:call-template name="body" />
  </xsl:template>

  <xsl:template name="field_metadata">
    <xsl:variable name="uc" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
    <xsl:variable name="lc" select="'abcdefghijklmnopqrstuvwxyz'"/>
    <xsl:choose>
      <xsl:when test="metadata/eainfo/detailed/attr[
          translate(normalize-space(../enttyp/enttypl/text()),$lc, $uc) =
          translate($entity,$lc, $uc) and
          translate(normalize-space(attrlabl/text()),$lc,$uc) =
          translate($field,$lc,$uc)
          ]">
      <div id="heading2">
        <h1>
          <xsl:value-of select="metadata/idinfo/citation/citeinfo/title" />
        </h1>
        <h2>
          Definition of
          <xsl:value-of select="$entity"/>.<xsl:value-of select="$field"/>
        </h2>
      </div>
      <div style="padding: 20px;">
        <xsl:apply-templates select="metadata/eainfo/detailed/attr[
          translate(normalize-space(../enttyp/enttypl/text()),$lc, $uc) =
          translate($entity,$lc, $uc) and
          translate(normalize-space(attrlabl/text()),$lc,$uc) =
          translate($field,$lc,$uc)
          ]" mode="body" />
        </div>
      </xsl:when>
      <xsl:otherwise>
        <div id="heading2">
        <h1>
          <xsl:value-of select="metadata/idinfo/citation/citeinfo/title" />
        </h1>
        <h2>Metadata Field Lookup Error</h2>
        </div>
        <div class="bodydiv">
          <p>Either the entity "<xsl:value-of select="$entity"/>" or the field
          "<xsl:value-of select="$field"/>" could not be found in the selected
          metadata.</p>
        </div>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="bum_call">
    <h1>Metadata not available</h1>
    <p>Metadata is not available for the selected object.</p>
  </xsl:template>


  <xsl:template name="body">
    <div style="padding: 5px; margin-right: 20px;">
      <xsl:apply-templates mode="body" select="Binary/Thumbnail[img/@src != '']" />
      <span class="labl">Contents</span>
      <ul style="margin-top: 0px">
        <li>
          <a><xsl:attribute name="href">#<xsl:value-of select="generate-id(idinfo)"/></xsl:attribute>
            Identification Information
          </a>
        </li>
        <xsl:if test="dataqual[.!='']">
          <li>
          <a><xsl:attribute name="href">#<xsl:value-of select="generate-id(dataqual)"/></xsl:attribute>
            Data Quality
          </a>
          </li>
        </xsl:if>
        <xsl:if test="eainfo[.!='']">
          <li>
          <a><xsl:attribute name="href">#<xsl:value-of select="generate-id(eainfo)"/></xsl:attribute>
            Entity and Attribute Information
          </a>
          </li>
        </xsl:if>
        <xsl:if test="spdoinfo[.!='']">
          <li>
          <a><xsl:attribute name="href">#<xsl:value-of select="generate-id(spdoinfo)"/></xsl:attribute>
            Spatial Data Organization Information
          </a>
          </li>
        </xsl:if>
        <xsl:if test="spref[.!='']">
          <li>
          <a><xsl:attribute name="href">#<xsl:value-of select="generate-id(spref)"/></xsl:attribute>
            Spatial Reference Information
          </a>
          </li>
        </xsl:if>
        <xsl:if test="distinfo[.!='']">
          <li>
          <a><xsl:attribute name="href">#<xsl:value-of select="generate-id(distinfo)"/></xsl:attribute>
            Distribution Information
          </a>
          </li>
        </xsl:if>
        <xsl:if test="metainfo[.!='']">
          <li>
          <a><xsl:attribute name="href">#<xsl:value-of select="generate-id(metainfo)"/></xsl:attribute>
            Metadata Reference Information
          </a>
          </li>
        </xsl:if>
      </ul>
      <xsl:apply-templates mode="body" select="idinfo" />
      <xsl:apply-templates mode="body" select="dataqual[. != '']" />
      <xsl:apply-templates mode="body" select="eainfo[. != '']" />
      <xsl:apply-templates mode="body" select="spdoinfo[. != '']" />
      <xsl:apply-templates mode="body" select="spref[. != '']" />
      <xsl:apply-templates mode="body" select="distinfo[. != '']" />
      <xsl:apply-templates mode="body" select="metainfo[. != '']" />
    </div>
  </xsl:template>

  <xsl:template match="comment() | processing-instruction()" mode="body" />

  <xsl:template match="idinfo" mode="body">
    <div class="topleveldiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <xsl:apply-templates select="descript" mode="body" />
      <xsl:apply-templates select="timeperd[. != '']" mode="body" />
      <xsl:apply-templates select="keywords[. != '']" mode="body" />
      <xsl:apply-templates select="taxonomy[. != '']" mode="body" />
      <xsl:apply-templates select="spdom[.!='']" mode="body" />
      <xsl:apply-templates select="accconst[. != '']" mode="body" />
      <xsl:apply-templates select="useconst[. != '']" mode="body" />
      <xsl:apply-templates select="status[. != '']" mode="body" />
      <xsl:apply-templates select="ptcontac[. != '']" mode="body" />
      <xsl:apply-templates select="secinfo[. != '']" mode="body" />
      <xsl:apply-templates select="browse[. != '']" mode="body" />
      <xsl:apply-templates select="native[. != '']" mode="body" />
      <xsl:apply-templates select="citation[. != '']" mode="body" />
      <xsl:apply-templates select="tool[.!='']" mode="body" />
      <a href="#heading">[top]</a>
    </div>
  </xsl:template>

  <xsl:template match="descript" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="sectdiv">
        <xsl:apply-templates select="abstract[. != '']" mode="body" />
        <xsl:apply-templates select="purpose[. != '']" mode="body" />
        <xsl:apply-templates select="supplinf[. != '']" mode="body" />
        <xsl:apply-templates select="langdata[. != '']" mode="body" />
      </div>
    </div>
  </xsl:template>

  <xsl:template match="keywords" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="sectdiv">
        <xsl:apply-templates select="theme[. != '']" mode="body" />
        <xsl:apply-templates select="place[. != '']" mode="body" />
        <xsl:apply-templates select="stratum[. != '']" mode="body" />
        <xsl:apply-templates select="temporal[. != '']" mode="body" />
      </div>
    </div>
  </xsl:template>

  <xsl:template match="spdom" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="sectdiv">
        <xsl:apply-templates select="descgeog[.!='']" mode="body" />
        <xsl:apply-templates select="bounding[.!='']" mode="body"/>
        <xsl:apply-templates select="lboundng[.!='']" mode="body" />
      </div>
    </div>
  </xsl:template>

  <xsl:template match="bounding|lboundng" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="content">
        <table class="tbl">
          <xsl:apply-templates select="westbc|leftbc" mode="body" />
          <xsl:apply-templates select="eastbc|rightbc" mode="body" />
          <xsl:apply-templates select="northbc|topbc" mode="body" />
          <xsl:apply-templates select="southbc|bottombc" mode="body" />
        </table>
      </div>
    </div>
  </xsl:template>

  <xsl:template match="status" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="content">
        <table class="tbl">
          <xsl:apply-templates select="progress" mode="body" />
          <xsl:apply-templates select="update" mode="body" />
        </table>
      </div>
    </div>
  </xsl:template>

  <xsl:template match="eainfo" mode="body">
    <div class="topleveldiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <xsl:apply-templates mode="body" select="overview" />
      <xsl:apply-templates mode="body" select="detailed" />
      <a href="#heading">[top]</a>
    </div>
  </xsl:template>

  <xsl:template match="dataqual | spdoinfo | spref | distinfo | metainfo" mode="body">
    <div class="topleveldiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <xsl:apply-templates mode="body" />
      <a href="#heading">[top]</a>
    </div>
  </xsl:template>

  <xsl:template match="detailed" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <xsl:apply-templates mode="body" select="enttyp" />
      <xsl:call-template name="attr-summary"/>
      <xsl:apply-templates mode="body" select="attr" />
      <xsl:apply-templates mode="body" select="subtype" />
      <xsl:apply-templates mode="body" select="relinfo" />
    </div>
  </xsl:template>

  <xsl:template match="enttyp" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="content2">
        <table class="tbl">
          <xsl:apply-templates select="enttypl" mode="body" />
          <xsl:apply-templates select="enttypd" mode="body" />
          <xsl:apply-templates select="enttypds" mode="body" />
          <xsl:apply-templates select="enttypt" mode="body" />
          <xsl:apply-templates select="enttypc" mode="body" />
        </table>
      </div>
    </div>
  </xsl:template>

  <xsl:template name="attr-summary">
    <xsl:if test="attr">
      <div class="bodydiv">
        <div class="labl">Attribute Summary</div>
        <div class="content2">
          <table class="tbl">
            <thead>
              <tr><th>Label</th><th>Definition</th></tr>
            </thead>
            <tbody>
              <xsl:for-each select="attr">
                <tr>
                  <td>
                    <a>
                      <xsl:attribute name="href">
                        <xsl:text>#</xsl:text>
                        <xsl:value-of select="generate-id(.)"/>
                      </xsl:attribute>
                      <xsl:apply-templates select="attrlabl/text()" mode="tablecell" />
                    </a>
                  </td>
                  <td><xsl:apply-templates select="attrdef/text()" mode="tablecell" /></td>
                </tr>
              </xsl:for-each>
            </tbody>
          </table>
        </div>
      </div>
    </xsl:if>
  </xsl:template>

  <xsl:template match="attr" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:value-of select="attrlabl/text()" />
      </div>
      <div class="sectdiv">
        <div class="content">
          <table class="tbl">
            <xsl:apply-templates select="attralias" mode="body" />
            <xsl:apply-templates select="attrdef" mode="body" />
            <xsl:apply-templates select="attrdefs" mode="body" />
            <xsl:apply-templates select="attrtype" mode="body" />
            <xsl:apply-templates select="attwidth" mode="body" />
            <xsl:apply-templates select="atprecis" mode="body" />
            <xsl:apply-templates select="attscale" mode="body" />
            <xsl:apply-templates select="atoutwid" mode="body" />
            <xsl:apply-templates select="atnumdec" mode="body" />
            <xsl:apply-templates select="atindex" mode="body" />
            <xsl:apply-templates select="begdatea" mode="body" />
            <xsl:apply-templates select="enddatea" mode="body" />
          </table>
        </div>
        <xsl:apply-templates select="attrdomv[.!='']" mode="body" />
        <xsl:apply-templates select="attrvai[.!='']" mode="body" />
        <xsl:apply-templates select="attrmfrq[.!='']" mode="body" />
        <xsl:apply-templates select="subtype[.!='']" mode="body" />
        <xsl:apply-templates select="relinfo[.!='']" mode="body" />
      </div>
    </div>
  </xsl:template>

  <xsl:template match="attrdomv[edom]" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <xsl:choose>
        <xsl:when test="edom">
          <div class="bodydiv">
            <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
            <div class="labl">
              <xsl:call-template name="node-name">
                <xsl:with-param name="name"><xsl:value-of select="local-name(edom)"/></xsl:with-param>
              </xsl:call-template>
            </div>
            <table class="tbl">
              <colgroup>
                <col valign="top"/>
                <col valign="top"/>
                <!-- col valign="top"/ -->
              </colgroup>
              <thead>
                <tr>
                  <th>Value</th>
                  <th>Definition</th>
                  <!-- th>Source</th -->
                </tr>
              </thead>
              <tbody>
                <xsl:apply-templates select="edom" mode="body">
                  <!-- xsl:sort select="edomv" / -->
                </xsl:apply-templates>
              </tbody>
            </table>
          </div>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates mode="body"/>
        </xsl:otherwise>
      </xsl:choose>
    </div>
  </xsl:template>

  <xsl:template match="edom" mode="body">
    <tr>
      <xsl:if test="(position() mod 2) = 0">
        <xsl:attribute name="class"><xsl:text>even</xsl:text></xsl:attribute>
      </xsl:if>
      <td>
        <xsl:apply-templates select="edomv/text()" mode="tablecell" />
      </td>
      <td>
        <xsl:apply-templates select="edomvd/text()" mode="tablecell" />
      </td>
      <!--
      <td>
        <xsl:apply-templates select="edomvds/text()" mode="body" />
      </td>
      -->
    </tr>
  </xsl:template>

  <xsl:template match="citeinfo" mode="body">
    <div class="bodydiv">
      <table class="tbl">
        <xsl:apply-templates select="title[.!='']" mode="body" />
        <xsl:apply-templates select="onlink[.!='']" mode="tr" />
        <xsl:apply-templates select="pubdate[.!='']" mode="body" />
        <xsl:apply-templates select="pubtime[.!='']" mode="body" />
        <xsl:apply-templates select="origin[.!='']" mode="body" />
        <xsl:apply-templates select="edition[.!='']" mode="body" />
        <xsl:apply-templates select="serinfo/sername[.!='']" mode="body" />
        <xsl:apply-templates select="serinfo/issue[.!='']" mode="body" />
        <xsl:apply-templates select="pubinfo/publish[.!='']" mode="body" />
        <xsl:apply-templates select="pubinfo/pubplace[.!='']" mode="body" />
        <xsl:apply-templates select="geoform[.!='']" mode="body" />
        <xsl:apply-templates select="othercit[.!='']" mode="body" />
        <xsl:apply-templates select="lworkcit[.!='']" mode="body" />
      </table>
    </div>
  </xsl:template>

  <xsl:template match="cntinfo" mode="body">
    <div class="bodydiv">
      <table class="tbl">
        <xsl:apply-templates select="cntperp/cntper[.!='']" mode="body" />
        <xsl:apply-templates select="cntperp/cntorg[.!='']" mode="body" />
        <xsl:apply-templates select="cntorgp/cntorg[.!='']" mode="body" />
        <xsl:apply-templates select="cntorgp/cntper[.!='']" mode="body" />
        <xsl:apply-templates select="cntpos[.!='']" mode="body" />
        <xsl:apply-templates select="cntaddr[.!='']" mode="body" />
        <xsl:apply-templates select="cntvoice[.!='']" mode="body" />
        <xsl:apply-templates select="cntfax[.!='']" mode="body" />
        <xsl:apply-templates select="cnttdd[.!='']" mode="body" />
        <xsl:apply-templates select="cntemail[.!='']" mode="body" />
        <xsl:apply-templates select="hours[.!='']" mode="body" />
      </table>
    </div>
    <xsl:apply-templates select="cntinst" mode="body" />
  </xsl:template>

  <xsl:template match="cntaddr" mode="body">
    <tr>
      <td>
        <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
        <span class="labl">
          <xsl:call-template name="node-name">
            <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
          </xsl:call-template>
        </span>
      </td>
      <td>
        <xsl:for-each select="address[.!='']">
          <xsl:value-of select="." />
          <br/>
        </xsl:for-each>
        <xsl:value-of select="city" />
        <xsl:text> </xsl:text>
        <xsl:value-of select="state" />
        <xsl:text> </xsl:text>
        <xsl:value-of select="postal" />
        <br/>
        <xsl:if test="country[.!='']">
          <xsl:value-of select="country" />
          <br/>
        </xsl:if>
        (<xsl:value-of select="addrtype"/>)
      </td>
    </tr>
  </xsl:template>

  <xsl:template match="albers|azimequi|equicon|equirect|gvnsp|gnomonic|lamberta
      |lambertc|mercator|modsak|miller|obqmerc|orthogr|polarst|polycon|robinson
      |sinusoid|spaceobq|stereo|transmer|vdgrin|mapprojp
      |behrmann|bonne|cassini|eckert1|eckert2|eckert3|eckert4|eckert5|eckert6
      |gallster|loxmuth|mollweid|quartic|winkel1|winkel
      |geodetic
      |altsys|depthsys
      |planci
      |local
      |esriterm|sdtsterm|vpfterm" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="content2">
        <table class="tbl">
          <xsl:apply-templates mode="body" />
        </table>
      </div>
    </div>
  </xsl:template>

  <xsl:template match="obqlazim|obqlpt|coordrep|distbrep|partTopoRules|vpfinfo|lworkcit" mode="body">
    <tr>
      <td>
        <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
        <span class="labl">
          <xsl:call-template name="node-name">
            <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
          </xsl:call-template>
        </span>
      </td>
      <td>
        <xsl:choose>
          <xsl:when test="citeinfo">
            <xsl:apply-templates mode="body" />
          </xsl:when>
          <xsl:otherwise>
            <table class="tbl2">
              <xsl:apply-templates mode="body" />
            </table>
          </xsl:otherwise>
        </xsl:choose>
      </td>
    </tr>
  </xsl:template>

  <xsl:template match="cntper|cntorg|cntpos|cntvoice|cntfax|cnttdd|cntemail
            |hours|attrlabl|attralias|attrdef|attrdefs|attrtype
            |attwidth|atprecis|attscale|atoutwid|atnumdec
            |atindex|begdatea|enddatea|enttypl|enttypd|enttypds|enttypt|enttypc
            |westbc|eastbc|northbc|southbc|leftbc|rightbc|topbc|bottombc
            |progress|update
            |title|pubdate|pubtime|origin|edition|sername|issue|publish|pubplace|geoform|othercit
            |stdparll|longcm|latprjo|feast|fnorth|sfequat|heightpt|longpc|latprjc|sfctrlin
            |azimangl|azimptl|obqllat|obqllong|svlong|sfprjorg|landsat|pathnum|sfctrmer
            |utmzone|upszone|spcszone|arczone
            |horizdn|ellips|semiaxis|denflat
            |altdatum|altres|altunits|altenc
            |depthdn|depthres|depthdu|depthem
            |plance|absres|ordres|distres|bearres|bearunit|bearrefd|bearrefm|plandu
            |localdes|localgeo
            |efeatyp|efeageom|esritopo|efeacnt|spindex|linrefer|netwrole|XYRank|ZRank
            |topoWeight|validateEvents|topoRuleID|featdesc
            |sdtstype|ptvctcnt
            |vpflevel|vpftype" mode="body">
    <tr>
      <td>
        <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
        <span class="labl">
          <xsl:call-template name="node-name">
            <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
          </xsl:call-template>
        </span>
      </td>
      <td>
        <xsl:apply-templates mode="tablecell" />
      </td>
    </tr>
  </xsl:template>

  <xsl:template match="taxoncl" mode="body">
    <xsl:if test=". != ''">
      <xsl:choose>
        <xsl:when test="local-name(..) != 'taxoncl'">
          <div class="bodydiv">
            <span class="labl">
              <xsl:call-template name="node-name">
                <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
              </xsl:call-template>
            </span>
            <div class="content2">
              <xsl:call-template name="taxonclValues" />
              <xsl:apply-templates select="taxoncl[.!='']" mode="body" />
            </div>
          </div>
        </xsl:when>
        <xsl:otherwise>
          <div class="content">
            <xsl:call-template name="taxonclValues" />
            <xsl:apply-templates select="taxoncl[.!='']" mode="body" />
          </div>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
  </xsl:template>

  <xsl:template name="taxonclValues">
    <span class="labl">
      <xsl:value-of select="taxonrn"/>
    </span>
    <xsl:text> </xsl:text>
    <xsl:value-of select="taxonrv" />
    <xsl:if test="common[.!='']">
      (<xsl:value-of select="common" />)
    </xsl:if>
  </xsl:template>

  <xsl:template match="pubdate|pubtime" mode="body">
    <tr>
      <td>
        <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
        <span class="labl">
          <xsl:call-template name="node-name">
            <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
          </xsl:call-template>
        </span>
      </td>
      <td>
        <xsl:choose>
          <xsl:when test="local-name(.) = 'pubdate'">
            <xsl:call-template name="formatDate" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="formatTime" />
          </xsl:otherwise>
        </xsl:choose>
      </td>
    </tr>
  </xsl:template>

  <xsl:template name="link" match="link" mode="body">
    <xsl:call-template name="makeLink">
      <xsl:with-param name="href"><xsl:value-of select="@href" /></xsl:with-param>
      <xsl:with-param name="target">_blank</xsl:with-param>
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="onlink" mode="body">
    <xsl:choose>
      <xsl:when test="starts-with(.,'Server=')">
        <!-- suppress SDE connection info -->
      </xsl:when>
      <xsl:otherwise>
        <div class="bodydiv">
          <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
          <div class="labl">
            <xsl:call-template name="node-name">
              <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
            </xsl:call-template>
          </div>
          <div class="content">
            <xsl:call-template name="makeLink">
              <xsl:with-param name="href"><xsl:value-of select="." /></xsl:with-param>
              <xsl:with-param name="target">_blank</xsl:with-param>
            </xsl:call-template>
          </div>
        </div>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="onlink" mode="tr">
    <xsl:choose>
      <xsl:when test="starts-with(.,'Server=')">
        <!-- suppress SDE connection info -->
      </xsl:when>
      <xsl:otherwise>
        <tr>
          <td>
            <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
            <span class="labl">
              <xsl:call-template name="node-name">
                <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
              </xsl:call-template>
            </span>
          </td>
          <td>
            <xsl:call-template name="makeLink">
              <xsl:with-param name="href"><xsl:value-of select="." /></xsl:with-param>
              <xsl:with-param name="target">_blank</xsl:with-param>
            </xsl:call-template>
          </td>
        </tr>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="makeLink">
    <xsl:param name="href" />
    <xsl:param name="text" />
    <xsl:param name="target" />
    <xsl:choose>
      <xsl:when test="starts-with($href, 'http://') or starts-with($href, 'ftp://')">
        <a href="{$href}">
          <xsl:if test="$target">
            <xsl:attribute name="target"><xsl:value-of select="$target" /></xsl:attribute>
          </xsl:if>
          <xsl:choose>
            <xsl:when test="$text"><xsl:value-of select="$text" /></xsl:when>
            <xsl:otherwise><xsl:value-of select="$href" /></xsl:otherwise>
          </xsl:choose>
        </a>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$href" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="theme|place|stratum|temporal|keywtax|methodid" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="content2">
          <xsl:apply-templates mode="body" select="(themekey|placekey|stratkey|tempkey|taxonkey|methkey)/text()" />
          <xsl:if test="(themekt|placekt|stratkt|tempkt|taxonkt|methkt)[.!='']">
            <xsl:text> (Thesaurus: </xsl:text>
            <xsl:value-of select="themekt|placekt|stratkt|tempkt|taxonkt|methkt"/>
            <xsl:text>)</xsl:text>
          </xsl:if>
      </div>
    </div>
  </xsl:template>

  <xsl:template match="procstep" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="sectdiv">
        <xsl:apply-templates select="procdesc[. != '']" mode="body" />
        <xsl:if test="procdate[. != '']">
          <div class="bodydiv">
            <div class="labl">Processed</div>
            <div class="content2">
              <xsl:apply-templates select="procdate/text()" mode="body" />
              <xsl:text> </xsl:text>
              <xsl:apply-templates select="proctime/text()" mode="body"/>
            </div>
          </div>
        </xsl:if>
        <xsl:apply-templates select="srcused | srcprod" mode="body" />
        <xsl:apply-templates select="proccont[.!= '']" mode="body" />
      </div>
    </div>
  </xsl:template>

  <xsl:template match="timeperd|srctime" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="sectdiv">
        <xsl:apply-templates select="(srccurr | current)[. != '']" mode="body" />
        <xsl:apply-templates select="timeinfo[. != '']" mode="body" />
      </div>
    </div>
  </xsl:template>

  <xsl:template match="timeinfo" mode="body">
    <div class="bodydiv">
      <xsl:apply-templates select="*[. != '']" mode="body" />
    </div>
  </xsl:template>

  <xsl:template match="sngdate" mode="body">
    <xsl:apply-templates mode="body" />
  </xsl:template>

  <xsl:template match="caldate | date | time" mode="body">
    <xsl:apply-templates mode="body" />
  </xsl:template>

  <xsl:template match="mdattim" mode="body">
    <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
    <div class="labl">
      <xsl:call-template name="node-name">
        <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
      </xsl:call-template>
    </div>
    <div class="content">
      <xsl:for-each select="sngdate[not(geolage) and . != '']">
        <xsl:if test="position() &gt; 1">
          <br/>
        </xsl:if>
        <xsl:apply-templates select="caldate" mode="body" />
        <xsl:if test="time[.!='']">
          <xsl:text> </xsl:text>
          <xsl:apply-templates select="time" mode="body" />
        </xsl:if>
      </xsl:for-each>
      <xsl:apply-templates select="sngdate/geolage[. != '']" mode="body" />
    </div>
  </xsl:template>

  <xsl:template match="rngdates[begdate or begtime or enddate or endtime]" mode="body">
    <xsl:apply-templates select="begdate/text()" mode="body" />
    <xsl:text> </xsl:text>
    <xsl:apply-templates select="begtime/text()[. != '']" mode="body" />
    <xsl:text> to </xsl:text>
    <xsl:apply-templates select="enddate/text()" mode="body" />
    <xsl:text> </xsl:text>
    <xsl:apply-templates select="endtime/text()[. != '']" mode="body" />
  </xsl:template>

  <xsl:template match="rngdates[beggeol or endgeol]" mode="body">
    <div>
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <xsl:apply-templates select="beggeol" mode="body" />
      <xsl:apply-templates select="endgeol" mode="body" />
    </div>
  </xsl:template>

  <xsl:template match="geolage[not(ancestor::beggeol or ancestor::endgeol)]" mode="body">
    <div>
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <xsl:apply-templates mode="body" />
    </div>
  </xsl:template>

  <xsl:template match="date[ancestor::procstep] | time[ancestor::procstep]" mode="body">
    <!-- ignore bogosity -->
  </xsl:template>

  <xsl:template match="text()[ancestor::pubdate or ancestor::metd or ancestor::metrd or ancestor::metfrd]" mode="body">
    <div class="content">
      <xsl:call-template name="formatDate" />
    </div>
  </xsl:template>

  <xsl:template name="formatDate" match="text()[ancestor::date or ancestor::caldate or
      ancestor::begdate or ancestor::enddate or ancestor::formverd
      or ancestor::begdatea or ancestor::enddatea or ancestor::procdate]" mode="body">
    <script>
      formatDate(&quot;<xsl:value-of select="normalize-space(.)"/>&quot;);
    </script>
    <noscript><xsl:value-of select="." /></noscript>
  </xsl:template>

  <xsl:template name="formatTime" match="text()[ancestor::time or ancestor::begtime
      or ancestor::endtime or ancestor::pubtime or ancestor::proctime]" mode="body">
    <script>
      formatTime(&quot;<xsl:value-of select="normalize-space(.)"/>&quot;);
    </script>
    <noscript><xsl:value-of select="." /></noscript>
  </xsl:template>

  <xsl:template match="text()[ancestor::themekey or ancestor::placekey or ancestor::stratkey
      or ancestor::tempkey or ancestor::taxonkey or ancestor::methkey]" mode="body">
    <xsl:if test="position() &gt; 1">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:value-of select="." />
  </xsl:template>

  <xsl:template match="abstract | purpose | supplinf" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="content2">
        <xsl:apply-templates mode="body" />
      </div>
    </div>
  </xsl:template>

  <xsl:template match="*" mode="body">
    <div class="bodydiv">
      <xsl:attribute name="id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
      <div class="labl">
        <xsl:call-template name="node-name">
          <xsl:with-param name="name"><xsl:value-of select="local-name(.)"/></xsl:with-param>
        </xsl:call-template>
      </div>
      <div class="sectdiv">
        <xsl:apply-templates mode="body" />
      </div>
    </div>
  </xsl:template>

  <xsl:template match="Thumbnail[img/@src != '']" mode="body">
    <div align="center">
      <img alt="thumbnail">
        <xsl:attribute name="src"><xsl:value-of select="img/@src"/></xsl:attribute>
      </img>
    </div>
  </xsl:template>

  <xsl:template match="text()[ancestor::srcused]" mode="body">
    <xsl:if test="normalize-space() != ''">
      <div class="content">
        <xsl:variable name="value"><xsl:value-of select="normalize-space(.)"/></xsl:variable>
        <xsl:variable name="href">
          <xsl:value-of select="generate-id(/metadata/dataqual/lineage/srcinfo[normalize-space(srccitea/text()) = $value])" />
        </xsl:variable>
        <xsl:choose>
          <xsl:when test="$href != ''">
            <a>
              <xsl:attribute name="href">
                <xsl:text>#</xsl:text>
                <xsl:value-of select="$href" />
              </xsl:attribute>
              <xsl:copy-of select="$value" />
            </a>
          </xsl:when>
          <xsl:otherwise>
            <xsl:copy-of select="$value" />
          </xsl:otherwise>
        </xsl:choose>
      </div>
    </xsl:if>
  </xsl:template>

  <xsl:template match="text()[ancestor::networkr]" mode="body">
    <xsl:if test="normalize-space() != ''">
      <div class="content">
        <xsl:call-template name="makeLink">
          <xsl:with-param name="href"><xsl:value-of select="." /></xsl:with-param>
          <xsl:with-param name="target">_blank</xsl:with-param>
        </xsl:call-template>
      </div>
    </xsl:if>
  </xsl:template>

  <xsl:template match="text()[ancestor::abstract or ancestor::purpose or ancestor::supplinf]" mode="body">
    <xsl:call-template name="br-replace2">
      <xsl:with-param name="word">
        <xsl:copy-of select="." />
      </xsl:with-param>
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="text()" mode="body">
    <xsl:if test="normalize-space() != ''">
      <div class="content">
        <xsl:call-template name="br-replace2">
          <xsl:with-param name="word">
            <xsl:copy-of select="." />
          </xsl:with-param>
        </xsl:call-template>
      </div>
    </xsl:if>
  </xsl:template>

  <xsl:template match="text()" mode="tablecell">
    <xsl:if test="normalize-space() != ''">
      <xsl:call-template name="br-replace2">
        <xsl:with-param name="word">
          <xsl:copy-of select="." />
        </xsl:with-param>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <xsl:template name="node-name">
    <xsl:param name="name" />
    <xsl:choose>

      <xsl:when test="$name = 'abstract'">
        <xsl:text>Abstract</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'absres'">
        <xsl:text>Abscissa Resolution</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'accconst'">
        <xsl:text>Access Contraints</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'accinstr'">
        <xsl:text>Access Instructions</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'address'">
        <xsl:text>Address</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'addrtype'">
        <xsl:text>Address Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'albers'">
        <xsl:text>Albers Conical Equal Area</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'altdatum'">
        <xsl:text>Altitude Datum Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'altenc'">
        <xsl:text>Altitude Encoding Method</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'altmax'">
        <xsl:text>Altitude Maximum</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'altmin'">
        <xsl:text>Altitude Minimum</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'altres'">
        <xsl:text>Altitude Resolution</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'altsys'">
        <xsl:text>Altitude System Definition</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'altunits'">
        <xsl:text>Altitude Units</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'arcsys'">
        <xsl:text>ARC Coordinate System</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'arczone'">
        <xsl:text>ARC System Zone Identifier</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'asciistr'">
        <xsl:text>ASCII File Structure</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'assndesc'">
        <xsl:text>Description of Association</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'atindex'">
        <!--xsl:text>Attribute Indexed</xsl:text-->
        <xsl:text>Indexed</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'atnumdec'">
        <!--xsl:text>Attribute Number of Decimals</xsl:text-->
        <xsl:text>Number of Decimals</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'atoutwid'">
        <!--xsl:text>Attribute Output Width</xsl:text-->
        <xsl:text>Output Width</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'atprecis'">
        <!--xsl:text>Attribute Precision</xsl:text-->
        <xsl:text>Precision</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attalias'">
        <!--xsl:text>Attribute Alias</xsl:text-->
        <xsl:text>Alias</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attr'">
        <xsl:text>Attribute</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attracc'">
        <xsl:text>Attribute Accuracy</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attracce'">
        <xsl:text>Attribute Accuracy Explanation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attraccr'">
        <xsl:text>Attribute Accuracy Report</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attraccv'">
        <xsl:text>Attribute Accuracy Value</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrdef'">
        <!--xsl:text>Attribute Definition</xsl:text-->
        <xsl:text>Definition</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrdefs'">
        <!--xsl:text>Attribute Definition Source</xsl:text-->
        <xsl:text>Definition Source</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrdomv'">
        <!--xsl:text>Attribute Domain Values</xsl:text-->
        <xsl:text>Domain Values</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrlabl'">
        <!--xsl:text>Attribute Label</xsl:text-->
        <xsl:text>Label</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrmfrq'">
        <!--xsl:text>Attribute Value Measurement Frequency</xsl:text-->
        <xsl:text>Value Measurement Frequency</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrmres'">
        <!--xsl:text>Attribute Measurement Resolution</xsl:text-->
        <xsl:text>Measurement Resolution</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrtype'">
        <!--xsl:text>Attribute Type</xsl:text-->
        <xsl:text>Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrunit'">
        <!--xsl:text>Attribute Units of Measure</xsl:text-->
        <xsl:text>Units of Measure</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrva'">
        <!--xsl:text>Attribute Value Accuracy</xsl:text-->
        <xsl:text>Value Accuracy</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrvae'">
        <!--xsl:text>Attribute Value Accuracy Explanation</xsl:text-->
        <xsl:text>Value Accuracy Explanation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attrvai'">
        <!--xsl:text>Attribute Value Accuracy Information</xsl:text-->
        <xsl:text>Value Accuracy Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attscale'">
        <!--xsl:text>Attribute Scale</xsl:text-->
        <xsl:text>Scale</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'attwidth'">
        <!--xsl:text>Attribute Width</xsl:text-->
        <xsl:text>Width</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'authent'">
        <xsl:text>Authentication</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'availabl'">
        <xsl:text>Available Time Period</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'azimangl'">
        <xsl:text>Azimuthal Angle</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'azimequi'">
        <xsl:text>Azimuthal Equidistant</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'azimptl'">
        <xsl:text>Azimuth Measure Point Longitude</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'bearers'">
        <xsl:text>Bearing Resolution</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'bearunit'">
        <xsl:text>Bearing Units</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'bearrefd'">
        <xsl:text>Bearing Reference Direction</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'bearrefm'">
        <xsl:text>Bearing Reference Meridian</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'begdate'">
        <xsl:text>Beginning Date</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'begdatea'">
        <xsl:text>Beginning Date of Attribute Values</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'beggeol'">
        <xsl:text>Beginning Geologic Age</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'begtime'">
        <xsl:text>Beginning Time</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'behrmann'">
        <xsl:text>Behrmann</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'Binary'">
        <xsl:text>Binary Enclosures</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'bonne'">
        <xsl:text>Bonne</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'bottombc'">
        <!-- xsl:text>Bottom Bounding Coordinate</xsl:text -->
        <xsl:text>Bottom</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'boundalt'">
        <xsl:text>Bounding Altitudes</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'bounding'">
        <xsl:text>Bounding Coordinates</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'browse'">
        <xsl:text>Browse Graphic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'browseem'">
        <xsl:text>Browse Graphic Embedded</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'browsed'">
        <xsl:text>Browse Graphic File Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'browsen'">
        <xsl:text>Browse Graphic File Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'browset'">
        <xsl:text>Browse Graphic File Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'caldate' or $name = 'date'">
        <xsl:text>Calendar Date</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'casesens'">
        <xsl:text>Case Sensitive</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cassini'">
        <xsl:text>Cassini</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'citation'">
        <xsl:text>Citation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'citeinfo'">
        <xsl:text>Citation Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'city'">
        <xsl:text>City</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'classcit'">
        <xsl:text>Classification System Citation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'classmod'">
        <xsl:text>Classification System Modifications</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'classsys'">
        <xsl:text>Classification System / Authority</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cloud'">
        <xsl:text>Cloud Cover</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'codesetd'">
        <xsl:text>Codeset Domain</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'codesetn'">
        <xsl:text>Codeset Domain Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'codesets'">
        <xsl:text>Codeset Domain Source</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'colcount'">
        <xsl:text>Column Count</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'common'">
        <xsl:text>Applicable Common Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'compat'">
        <xsl:text>Compatibility Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'complete'">
        <xsl:text>Completeness Report</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'compress'">
        <xsl:text>Compression Support</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'computer'">
        <xsl:text>Computer Contact Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'connrule'">
        <xsl:text>Connectivity Rule</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'coordrep'">
        <xsl:text>Coordinate Representation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cordsysn'">
        <xsl:text>Coordinate System Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'country'">
        <xsl:text>Country</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntaddr'">
        <!--xsl:text>Contact Address</xsl:text-->
        <xsl:text>Address</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntemail'">
        <!--xsl:text>Contact Electronic Mail Address</xsl:text-->
        <xsl:text>E-Mail</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntfax'">
        <!--xsl:text>Contact Facsimile Telephone</xsl:text-->
        <xsl:text>FAX</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntinfo'">
        <xsl:text>Contact Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntinst'">
        <!--xsl:text>Contact Instructions</xsl:text-->
        <xsl:text>Instructions</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntorg'">
        <!--xsl:text>Contact Organization</xsl:text-->
        <xsl:text>Organization</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntorgp'">
        <!--xsl:text>Contact Organization Primary</xsl:text-->
        <xsl:text>Primary Organization</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntper'">
        <!--xsl:text>Contact Person</xsl:text-->
        <xsl:text>Person</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntperp'">
        <!--xsl:text>Contact Person Primary</xsl:text-->
        <xsl:text>Primary Person</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntpos'">
        <!--xsl:text>Contact Position</xsl:text-->
        <xsl:text>Position</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cnttdd'">
        <!--xsl:text>Contact TDD/TTY Telephone</xsl:text-->
        <xsl:text>TDD/TTY</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'cntvoice'">
        <!--xsl:text>Contact Voice Telephone</xsl:text-->
        <xsl:text>Voice</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'crossref'">
        <xsl:text>Cross Reference</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'current'">
        <xsl:text>Currentness Reference</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'custom'">
        <xsl:text>Custom Order Process</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'Data'">
        <xsl:text>Data</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'database'">
        <xsl:text>Database Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'datacred'">
        <xsl:text>Dataset Credit</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'datafiel'">
        <xsl:text>Data Field</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dataqual'">
        <xsl:text>Data Quality</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'denflat'">
        <xsl:text>Denominator of Flattening Ratio</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'depthdn'">
        <xsl:text>Depth Datum Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'depthdu'">
        <xsl:text>Depth Distance Units</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'depthen'">
        <xsl:text>Depth Encoding Method</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'depthres'">
        <xsl:text>Depth Resolution</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'depthsys'">
        <xsl:text>Depth System Definition</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'descgeog'">
        <xsl:text>Description of Geographic Extent</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'deschead'">
        <xsl:text>Description of Header Content</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'descript'">
        <xsl:text>Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'Descript'">
        <xsl:text>Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'detailed'">
        <xsl:text>Detailed Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dfieldnm'">
        <xsl:text>Data Field Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dfwidth'">
        <xsl:text>Data Field Width</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dfwidthd'">
        <xsl:text>Data Field Width Delimiter</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dialfile'">
        <xsl:text>Dialup Filename</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dialinst'">
        <xsl:text>Dialup Instructions</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dialtel'">
        <xsl:text>Dialup Telephone</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'digform'">
        <xsl:text>Digital Form</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'digtinfo'">
        <xsl:text>Digital Transfer Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'digtopt'">
        <xsl:text>Digital Transfer Option</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'direct'">
        <xsl:text>Direct Spatial Reference Method</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'distbear'">
        <xsl:text>Distance and Bearing Represenation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'distinfo'">
        <xsl:text>Distribution Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'distliab'">
        <xsl:text>Distribution Liability</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'distress'">
        <xsl:text>Distance Resolution</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'distrib'">
        <xsl:text>Distributor</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'domdesc'">
        <xsl:text>Domain Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'domfldtp'">
        <xsl:text>Domain Attribute Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'domname'">
        <xsl:text>Domain Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'domowner'">
        <xsl:text>Domain Owner</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'domtype'">
        <xsl:text>Domain Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dsgpoly'">
        <xsl:text>Dataset G-Polygon</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dsgpolyo'">
        <xsl:text>Dataset G-Polygon Outer G-Ring</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dsgpolyx'">
        <xsl:text>Dataset G-Polygon Exclusion G-Rign</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dsoverv'">
        <xsl:text>Dataset Overview</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dssize'">
        <xsl:text>Dataset Size</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dtfcfkey'">
        <xsl:text>Destination Foreign Key</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dtfcname'">
        <xsl:text>Destination Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'dtfcpkey'">
        <xsl:text>Destination Primary Key</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eadetcit'">
        <xsl:text>Entity and Attribute Detail Citation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eainfo'">
        <xsl:text>Entity and Attribute Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eaover'">
        <xsl:text>Entity and Attribute Overview</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eastbc'">
        <!--xsl:text>East Bounding Coordinate</xsl:text-->
        <xsl:text>East</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eckert1'">
        <xsl:text>Eckert I</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eckert2'">
        <xsl:text>Eckert II</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eckert3'">
        <xsl:text>Eckert III</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eckert4'">
        <xsl:text>Eckert IV</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eckert5'">
        <xsl:text>Eckert V</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eckert6'">
        <xsl:text>Eckert VI</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'edition'">
        <xsl:text>Edition</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'edom'">
        <xsl:text>Enumerated Domain</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'edomv'">
        <xsl:text>Enumerated Domain Value</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'edomvd'">
        <xsl:text>Enumerated Domain Value Definition</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'edomvds'">
        <xsl:text>Enumerated Domain Value Definition Source</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'efeacnt'">
        <xsl:text>ESRI Feature Count</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'efeageom'">
        <xsl:text>ESRI Feature Geometry</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'efeatyp'">
        <xsl:text>ESRI Feature Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'eframes'">
        <xsl:text>Data Frames</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'elemcls'">
        <xsl:text>Network Element</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ellips'">
        <xsl:text>Ellipsoid Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'enabfld'">
        <xsl:text>Enabled Attribute</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'Enclosure'">
        <xsl:text>Enclosure</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'enddate'">
        <xsl:text>End Date</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'enddatea'">
        <xsl:text>Ending Date of Attribute Values</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'endgeol'">
        <xsl:text>Ending Geologic Age</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'endtime'">
        <xsl:text>End Time</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'enttyp'">
        <!-- xsl:text>Entity Type</xsl:text -->
        <xsl:text>Entity</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'enttypc'">
        <!-- xsl:text>Entity Type Count</xsl:text -->
        <xsl:text>Count</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'enttypd'">
        <!--xsl:text>Entity Type Definition</xsl:text-->
        <xsl:text>Definition</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'enttypds'">
        <!--xsl:text>Entity Type Definition Source</xsl:text-->
        <xsl:text>Definition Source</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'enttypl'">
        <!--xsl:text>Entity Type Label</xsl:text-->
        <xsl:text>Label</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'enttypt'">
        <!--xsl:text>Type</xsl:text-->
        <xsl:text>Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'equicon'">
        <xsl:text>Equidistant Conic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'equirect'">
        <xsl:text>Equirectangular</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'esriterm'">
        <xsl:text>ESRI Terms Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'esritopo'">
        <xsl:text>ESRI Topology</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'feast'">
        <xsl:text>False Easting</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'featdesc'">
        <xsl:text>Feature Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'fees'">
        <xsl:text>Fees</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'filedec'">
        <xsl:text>File Decompression Technique</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'fnorth'">
        <xsl:text>False Northing</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'formcont'">
        <xsl:text>Format Information Content</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'formname'">
        <xsl:text>Format Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'formspec'">
        <xsl:text>Format Specification</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'formverd'">
        <xsl:text>Format Version Date</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'formvern'">
        <xsl:text>Format Version Number</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'framect'">
        <xsl:text>Data Frame Count</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'framenam'">
        <xsl:text>Data Frame Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ftname'">
        <xsl:text>File or Table Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'gallster'">
        <xsl:text>Gall Stereographic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geodetic'">
        <xsl:text>Geodetic Model</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geoform'">
        <xsl:text>Geospatial Data Presentation Form</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geogcsn'">
        <xsl:text>Geographic Coordinate System Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geograph'">
        <xsl:text>Geographic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geogunit'">
        <xsl:text>Geographic Coordinate Units</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geolage'">
        <xsl:text>Geologic Age</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geolcit'">
        <xsl:text>Geologic Citation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geolest'">
        <xsl:text>Geologic Age Estimate</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geolexpl'">
        <xsl:text>Geologic Age Explanation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geolscal'">
        <xsl:text>Geologic Time Scale</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'geolun'">
        <xsl:text>Geologic Age Uncertainty</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'gnomonic'">
        <xsl:text>Gnomonic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'gridsys'">
        <xsl:text>Grid Coordinate System</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'gridsysn'">
        <xsl:text>Grid Coordinate System Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'gring'">
        <xsl:text>G-Ring</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'gringlat'">
        <xsl:text>G-Ring Latitude</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'gringlon'">
        <xsl:text>G-Ring Longitude</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'grngpoin'">
        <xsl:text>G-Ring Point</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'gvnsp'">
        <xsl:text>General Vertical Near-Sided Perspective</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'heightpt'">
        <xsl:text>Height of Perspective Point Above Surface</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'highbps'">
        <xsl:text>Highest BPS</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'horizdn'">
        <xsl:text>Horizontal Datum Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'horizpa'">
        <xsl:text>Horizontal Positional Accuracy</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'horizpae'">
        <xsl:text>Horizontal Positional Accuracy Explanation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'horizpar'">
        <xsl:text>Horizontal Positional Accuracy Report</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'horizpav'">
        <xsl:text>Horizontal Positional Accuracy Value</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'horizsys'">
        <xsl:text>Horizontal Coordinate System Definition</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'hours'">
        <xsl:text>Hours of Service</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ider'">
        <xsl:text>Identifier</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'idinfo'">
        <xsl:text>Identification Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'idref'">
        <xsl:text>Identification Reference</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'indspref'">
        <xsl:text>Indirect Spatial Reference</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'instance'">
        <xsl:text>Instance Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'issue'">
        <xsl:text>Issue Identification</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'junctid'">
        <xsl:text>Available Junction Feature Class</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'junctst'">
        <xsl:text>Available Junction Subtype</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'keywords'">
        <xsl:text>Keywords</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'keywtax'">
        <xsl:text>Keywords / Taxon</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'lamberta'">
        <xsl:text>Lambert Azimuthal Equal Area</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'lambertc'">
        <xsl:text>Lambert Conformal Conic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'landsat'">
        <xsl:text>Landsat Number</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'langdata'">
        <xsl:text>Language of Dataset</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'langmeta'">
        <xsl:text>Language of Metadata</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'latprjc'">
        <xsl:text>Latitude of Projection Center</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'latprjo'">
        <xsl:text>Latitude of Projection Origin</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'latres'">
        <xsl:text>Latitude Resolution</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'lboundng'">
        <xsl:text>Local Bounding Coordinates</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'leftbc'">
        <!-- xsl:text>Left Bounding Coordinate</xsl:text -->
        <xsl:text>Left</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'lineage'">
        <xsl:text>Lineage</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'linrefer'">
        <xsl:text>Linear Referencing</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'local'">
        <xsl:text>Local</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'localdes'">
        <xsl:text>Local Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'localgeo'">
        <xsl:text>Local Georeference Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'localp'">
        <xsl:text>Local Planar</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'localpd'">
        <xsl:text>Local Planar Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'localpgi'">
        <xsl:text>Local Planar Georeference Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'logic'">
        <xsl:text>Logical Consistency Report</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'longcm'">
        <xsl:text>Longitude of Central Meridian</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'longpc'">
        <xsl:text>Longitude of Projection Center</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'longres'">
        <xsl:text>Longitude Resolution</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'lowbps'">
        <xsl:text>Lowest BPS</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'loxmuth'">
        <xsl:text>Loximuthal</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'lworkcit'">
        <xsl:text>Larger Work Citation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'mapproj'">
        <xsl:text>Map Projection</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'mapprojn'">
        <xsl:text>Map Projection Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'mapprojp'">
        <xsl:text>Map Projection Parameters</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'maxalti'">
        <xsl:text>Maximum Altitude</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'mdattim'">
        <xsl:text>Multiple Dates/Times</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'mercator'">
        <xsl:text>Mercator</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metac'">
        <xsl:text>Metadata Access Contraints</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metadata'">
        <xsl:text>Metadata</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metainfo'">
        <xsl:text>Metadata Reference Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metc'">
        <xsl:text>Metadata Contact</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metd'">
        <xsl:text>Metadata Date</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metextns'">
        <xsl:text>Metadata Extensions</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metfrd'">
        <xsl:text>Metadata Future Review Date</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'methcite'">
        <xsl:text>Methodology Citation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'methdesc'">
        <xsl:text>Methodology Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'methkey'">
        <xsl:text>Methodology Keyword</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'methkt'">
        <xsl:text>Methodology Keyword Thesaurus</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'method'">
        <xsl:text>Methodology</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'methodid'">
        <xsl:text>Methodology Identifier</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'methtype'">
        <xsl:text>Methodology Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metprof'">
        <xsl:text>Profile Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metrd'">
        <xsl:text>Metadata Review Date</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metsc'">
        <xsl:text>Metadata Security Classification</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metscs'">
        <xsl:text>Metadata Security Classification System</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metsi'">
        <xsl:text>Metadata Security Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metshd'">
        <xsl:text>Metadata Security Handling Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metstdn'">
        <xsl:text>Metadata Standard Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metstdv'">
        <xsl:text>Metadata Standard Version</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'mettc'">
        <xsl:text>Metadata Time Convention</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'metuc'">
        <xsl:text>Metadata Use Contraints</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'mfgtype'">
        <xsl:text>Merge Rule</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'miller'">
        <xsl:text>Miller Cylindrical</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'minalti'">
        <xsl:text>Minimum Altitude</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'missingv'">
        <xsl:text>Missing Value Code</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'modsak'">
        <xsl:text>Modified Stereographic for Alaska</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'mollweid'">
        <xsl:text>Mollweide</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'native'">
        <xsl:text>Native Dataset Environment</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'natvform'">
        <xsl:text>Native Dataset Format</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'netinfo'">
        <xsl:text>Geometric Network Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'nettype'">
        <xsl:text>Network Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'networka'">
        <xsl:text>Network Address</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'networkr'">
        <xsl:text>Network Resource Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'netwrole'">
        <xsl:text>Network Role</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'nondig'">
        <xsl:text>Non-Digital Form</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'northbc'">
        <!--xsl:text>North Bounding Coordinate</xsl:text-->
        <xsl:text>North</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'numdata'">
        <xsl:text>Number of DataBits</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'numheadl'">
        <xsl:text>Number of Header Lines</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'numstop'">
        <xsl:text>Number of StopBits</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'obqlazim'">
        <xsl:text>Oblique Line Azimuth</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'obqlpt'">
        <xsl:text>Oblique Line Point</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'obqllat'">
        <xsl:text>Oblique Line Latitude</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'obqllong'">
        <xsl:text>Oblique Line Longitude</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'obqmerc'">
        <xsl:text>Oblique Mercator</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'offmedia'">
        <xsl:text>Offline Media</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'offoptn'">
        <xsl:text>Offline Option</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'oncomp'">
        <xsl:text>Online Computer and Operating System</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'onlink'">
        <xsl:text>Online Linkage</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'onlinopt'">
        <xsl:text>Online Option</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ordering'">
        <xsl:text>Ordering Instructions</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ordres'">
        <xsl:text>Ordinate Resolution</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'orienta'">
        <xsl:text>Orientation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'origin'">
        <xsl:text>Originator</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'orthogr'">
        <xsl:text>Orthographic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'otfcfkey'">
        <xsl:text>Origin Foreign Key</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'otfcname'">
        <xsl:text>Origin Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'otfcpkey'">
        <xsl:text>Origin Primary Key</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'othercit'">
        <xsl:text>Other Citation Details</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'othergrd'">
        <xsl:text>Other Grid System Definition</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'otherprj'">
        <xsl:text>Other Projection Definition</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'overview'">
        <xsl:text>Overview Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'parity'">
        <xsl:text>Parity</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'partTopoRules'">
        <xsl:text>Participates in Topology Rules</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'pathnum'">
        <xsl:text>Path Number</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'place'">
        <xsl:text>Place</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'placekey'">
        <xsl:text>Place Keywords</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'placekt'">
        <xsl:text>Place Keyword Thesaurus</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'planar'">
        <xsl:text>Planar</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'plance'">
        <xsl:text>Planar Coordinate Encoding Method</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'planci'">
        <xsl:text>Planar Coordinate Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'plandu'">
        <xsl:text>Planar Distance Units</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'polarst'">
        <xsl:text>Polar Stereographic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'polycon'">
        <xsl:text>Polyconic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'posacc'">
        <xsl:text>Positional Accuracy</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'postal'">
        <xsl:text>Postal Code</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'proccont'">
        <xsl:text>Process Contact Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'procdate'">
        <xsl:text>Process Date</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'procdesc'">
        <xsl:text>Process Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'procstep'">
        <xsl:text>Process Step</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'procsv'">
        <xsl:text>Process Software and Version</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'proctime'">
        <xsl:text>Process Time</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'progress'">
        <xsl:text>Progress</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'projcsn'">
        <xsl:text>Projected Coordinate System Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ptcontac'">
        <xsl:text>Point of Contact</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ptvctcnt'">
        <xsl:text>Point and Vector Object Type Count</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ptvctinf'">
        <xsl:text>Point and Vector Object Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'publish'">
        <xsl:text>Publisher</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'pubdate'">
        <xsl:text>Publication Date</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'pubinfo'">
        <xsl:text>Publication Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'pubplace'">
        <xsl:text>Publication Place</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'pubtime'">
        <xsl:text>Publication Time</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'purpose'">
        <xsl:text>Purpose</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'qattracc'">
        <xsl:text>Quantitative Attribute Accuracy Assessment</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'qhorizpa'">
        <xsl:text>Quantitative Horizontal Positional Accuracy Assessment</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'quartic'">
        <xsl:text>Quartic Authalic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'quotech'">
        <xsl:text>Quote Character</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'qvertpa'">
        <xsl:text>Quantitative Vertical Positional Accuracy Assessment</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastband'">
        <xsl:text>Number of Bands</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastbpp'">
        <xsl:text>Bits Per Pixel</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastcmap'">
        <xsl:text>Image Colormap</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastcomp'">
        <xsl:text>Compression Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastdtyp'">
        <xsl:text>Raster Display Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastifor'">
        <xsl:text>Image Format</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastinfo'">
        <xsl:text>Raster Object Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastityp'">
        <xsl:text>Image Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastnodt'">
        <xsl:text>Background Nodata Value</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastorig'">
        <xsl:text>Raster Origin</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastplyr'">
        <xsl:text>Pyramid Layers</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rasttype'">
        <xsl:text>Raster Object Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastxsz'">
        <xsl:text>Cell Size X Direction</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastxu'">
        <xsl:text>Cell Size X Units</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastysz'">
        <xsl:text>Cell Size Y Direction</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rastyu'">
        <xsl:text>Cell Size Y Units</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rdom'">
        <xsl:text>Range Domain</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rdommax'">
        <xsl:text>Range Domain Maximum</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rdommean'">
        <xsl:text>Range Domain Mean</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rdommin'">
        <xsl:text>Range Domain Minimum</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rdomstdv'">
        <xsl:text>Range Domain Standard Deviation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'recap'">
        <xsl:text>Recording Capacity</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'recdel'">
        <xsl:text>Record Delimiter</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'recden'">
        <xsl:text>Recording Density</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'recdenu'">
        <xsl:text>Recording Density Units</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'recfmt'">
        <xsl:text>Recording Format</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'relattr'">
        <xsl:text>Attributed Relationship</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'relblab'">
        <xsl:text>Relationship Backward Label</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'relcard'">
        <xsl:text>Relationship Cardinality</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'relcomp'">
        <xsl:text>Composite Relationship</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'reldesc'">
        <xsl:text>Description of Relationship</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'relflab'">
        <xsl:text>Relationship Forward Label</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'relinfo'">
        <xsl:text>Relationship Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'relnodir'">
        <xsl:text>Notification Direction</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'reposit'">
        <xsl:text>Repository</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'resdesc'">
        <xsl:text>Resource Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rightbc'">
        <!--xsl:text>Right Bounding Coordinate</xsl:text-->
        <xsl:text>Right</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rngdates'">
        <xsl:text>Range of Dates/Times</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'robinson'">
        <xsl:text>Robinson</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rolefld'">
        <xsl:text>Ancillary Role Attribute</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'roletype'">
        <xsl:text>Ancillary Role</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rowcount'">
        <xsl:text>Row Count</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rulecat'">
        <xsl:text>Rule Category</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ruledjid'">
        <xsl:text>Default Junction Feature Class</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ruledjst'">
        <xsl:text>Default Junction Subtype</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ruleeid'">
        <xsl:text>Edge Feature Class</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ruleemnc'">
        <xsl:text>Edge Minimum Cardinality</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ruleemxc'">
        <xsl:text>Edge Maximum Cardinality</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ruleest'">
        <xsl:text>Edge Subtype</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rulefeid'">
        <xsl:text>From Edge Feature Class</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rulefest'">
        <xsl:text>From Edge Subtype</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rulehelp'">
        <xsl:text>Rule Help</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rulejid'">
        <xsl:text>Junction Feature Class</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rulejmnc'">
        <xsl:text>Junction Minimum Cardinality</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rulejmxc'">
        <xsl:text>Junction Maximum Cardinality</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rulejst'">
        <xsl:text>Junction Subtype</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'rulejunc'">
        <xsl:text>Available Junction</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ruleteid'">
        <xsl:text>To Edge Feature Class</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ruletest'">
        <xsl:text>To Edge Subtype</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ruletype'">
        <xsl:text>Rule Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sdeconn'">
        <xsl:text>SDE Connection Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sdtsterm'">
        <xsl:text>SDTS Terms Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sdtstype'">
        <xsl:text>SDTS Point and Vector Object Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'secclass'">
        <xsl:text>Security Classification</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sechandl'">
        <xsl:text>Security Handling Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'secinfo'">
        <xsl:text>Security Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'secsys'">
        <xsl:text>Security Classification System</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'semiaxis'">
        <xsl:text>Semi-Major Axis</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'serinfo'">
        <xsl:text>Series Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sername'">
        <xsl:text>Series Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'server'">
        <xsl:text>Server Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sfctrlin'">
        <xsl:text>Scale Factor at Center Line</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sfctrmer'">
        <xsl:text>Scale Factor at Central Meridian</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sfequat'">
        <xsl:text>Scale Factor at Equator</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sfprjorg'">
        <xsl:text>Scale Factor at Projection Origin</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sinusoid'">
        <xsl:text>Sinusoidal</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'sngdate'">
        <xsl:text>Single Date/Time</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'southbc'">
        <!--xsl:text>South Bounding Coordinate</xsl:text-->
        <xsl:text>South</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'spaceobq'">
        <xsl:text>Space Oblique Mercator (Landsat)</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'spcs'">
        <xsl:text>State Plance Coordinate System (SPCS)</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'spcszone'">
        <xsl:text>SPCS Zone Identifier</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'spdoinfo'">
        <xsl:text>Spatial Data Organization Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'spdom'">
        <xsl:text>Spatial Domain</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'specimen'">
        <xsl:text>Specimen</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'spindex'">
        <xsl:text>Spatial Index</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'splttype'">
        <xsl:text>Split Rule</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'spref'">
        <xsl:text>Spatial Reference</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'srccite'">
        <xsl:text>Source Citation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'srccitea'">
        <xsl:text>Source Citation Abbreviation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'srccontr'">
        <xsl:text>Source Contribution</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'srccurr'">
        <xsl:text>Source Currentness Reference</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'srcinfo'">
        <xsl:text>Source Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'srcprod'">
        <xsl:text>Source Produced Citation Abbreviation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'srcscale'">
        <xsl:text>Source Scale Denominator</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'srctime'">
        <xsl:text>Source Time Period of Content</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'srcused'">
        <xsl:text>Source Used Citation Abbreviation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'state'">
        <xsl:text>State or Province</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'status'">
        <xsl:text>Status</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stcode'">
        <xsl:text>Subtype Code</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stdorder'">
        <xsl:text>Standard Order Process</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stdparll'">
        <xsl:text>Standard Parallel</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stereo'">
        <xsl:text>Stereographic</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stfield'">
        <xsl:text>Subtype Attribute</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stflddd'">
        <xsl:text>Attribute Defined Domain</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stflddv'">
        <xsl:text>Subtype Default Value</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stfldnm'">
        <xsl:text>Subtype Attribute Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stname'">
        <xsl:text>Subtype Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stratum'">
        <xsl:text>Stratum</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stratkey'">
        <xsl:text>Stratum Keywords</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'stratkt'">
        <xsl:text>Stratum Keyword Thesaurus</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'subtype'">
        <xsl:text>Subtype Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'supplinf'">
        <xsl:text>Supplemental Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'svlong'">
        <xsl:text>Straight Vertical Longitude from Pole</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'taxoncl'">
        <xsl:text>Taxonomic Classification</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'taxoncom'">
        <xsl:text>Taxonomic Completeness</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'taxongen'">
        <xsl:text>General Taxonomic Coverage</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'taxonkey'">
        <xsl:text>Taxonomic Keywords</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'taxonkt'">
        <xsl:text>Taxonomic Keyword Thesaurus</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'taxonomy'">
        <xsl:text>Taxonomy</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'taxonpro'">
        <xsl:text>Taxonomic Procedures</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'taxonrn'">
        <xsl:text>Taxonomic Rank Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'taxonrv'">
        <xsl:text>Taxonomic Rank Value</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'taxonsys'">
        <xsl:text>Taxonomic System</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'techpreq'">
        <xsl:text>Technical Prerequisites</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'temporal'">
        <xsl:text>Temporal</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'tempkey'">
        <xsl:text>Temporal Keywords</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'tempkt'">
        <xsl:text>Temporal Keyword Thesaurus</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'theme'">
        <xsl:text>Theme</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'themekey'">
        <xsl:text>Theme Keywords</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'themekt'">
        <xsl:text>Theme Keyword Thesaurus</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'Thumbnail'">
        <xsl:text>Thumbnail</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'time'">
        <xsl:text>Time of Day</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'timeinfo'">
        <xsl:text>Time Period Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'timeperd'">
        <xsl:text>Time Period of Content</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'title'">
        <xsl:text>Title</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'tool'">
        <xsl:text>Analytical Tool</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'toolacc'">
        <xsl:text>Tool Access Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'toolcite'">
        <xsl:text>Tool Citation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'toolcomp'">
        <xsl:text>Tool Computer and Operating System</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'toolcont'">
        <xsl:text>Tool Contact</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'tooldesc'">
        <xsl:text>Analytical Tool Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'toolinst'">
        <xsl:text>Tool Access Instructions</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'topbc'">
        <!--xsl:text>Top Bounding Coordinate</xsl:text-->
        <xsl:text>Top</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'topoRuleID'">
        <xsl:text>Topology Rule ID</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'topoWeight'">
        <xsl:text>Topology Weight</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'transmer'">
        <xsl:text>Transverse Mercator</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'transize'">
        <xsl:text>Transfer Size</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'turnarnd'">
        <xsl:text>Turnaround</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'typesrc'">
        <xsl:text>Type of Source Media</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'udom'">
        <xsl:text>Unrepresentable Domain</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'update'">
        <xsl:text>Maintenance and Update Frequency</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ups'">
        <xsl:text>Universal Polar Stereographic (UPS)</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'upszone'">
        <xsl:text>UPS Zone Identifier</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'useconst'">
        <xsl:text>Use Contraints</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'user'">
        <xsl:text>User Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'utm'">
        <xsl:text>Universal Transverse Mercator (UTM)</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'utmzone'">
        <xsl:text>UTM Zone Number</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'validateEvents'">
        <xsl:text>Events on Validation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vdgrin'">
        <xsl:text>van der Grinten</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'version'">
        <xsl:text>Version Name</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vertacc'">
        <xsl:text>Vertical Positional Accuracy</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vertacce'">
        <xsl:text>Vertical Positional Accuracy Explanation</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vertaccr'">
        <xsl:text>Vertical Positional Accuracy Report</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vertaccv'">
        <xsl:text>Vertical Positional Accuracy Value</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vertcount'">
        <xsl:text>Vertical Count</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vertdef'">
        <xsl:text>Vertical Coordinate System Definition</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vouchers'">
        <xsl:text>Vouchers</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vpfinfo'">
        <xsl:text>VPF Point and Vector Object Information</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vpflevel'">
        <xsl:text>VPF Topology Level</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vpfterm'">
        <xsl:text>VPF Terms Description</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'vpftype'">
        <xsl:text>VPF Point and Vector Object Type</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'winkel1'">
        <xsl:text>Winkel I</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'winkel2'">
        <xsl:text>Winkell II</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'westbc'">
        <!--xsl:text>West Bounding Coordinate</xsl:text-->
        <xsl:text>West</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'XYRank'">
        <xsl:text>XY Rank</xsl:text>
      </xsl:when>
      <xsl:when test="$name = 'ZRank'">
        <xsl:text>Z Rank</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$name" />
        <xsl:text>*</xsl:text>
      </xsl:otherwise>

    </xsl:choose>
  </xsl:template>

  <xsl:template name="br-replace">
    <xsl:param name="word"/>
    <!-- </xsl:text> on next line on purpose to get newline -->
    <xsl:variable name="nl"><xsl:text>&#xA;</xsl:text></xsl:variable>
    <xsl:variable name="cr"><xsl:text>&#xD;</xsl:text></xsl:variable>
    <xsl:choose>
      <xsl:when test="contains($word,$nl)">
  <xsl:value-of select="translate(substring-before($word,$nl),$cr,' ')"/>
  <br/>
  <xsl:call-template name="br-replace">
    <xsl:with-param name="word"
        select="substring-after($word,$nl)"/>
  </xsl:call-template>
      </xsl:when>
      <xsl:when test="string-length($word)=0"/>
      <xsl:otherwise>
  <xsl:value-of select="translate(translate($word,$cr,' '),$nl,' ')"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="br-replace2">
    <xsl:param name="word"/>
    <xsl:variable name="beginPre">
      <xsl:text>-- BEGIN ORIGINAL METADATA</xsl:text>
    </xsl:variable>
    <xsl:variable name="endPre">
      <xsl:text>-- END ORIGINAL METADATA --</xsl:text>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="contains($word,$beginPre) and contains($word,$endPre)">
  <xsl:call-template name="br-replace">
    <xsl:with-param name="word">
      <xsl:copy-of select="substring-before($word,$beginPre)"/>
    </xsl:with-param>
  </xsl:call-template>
  <pre>
    <xsl:value-of select="$beginPre"/><xsl:copy-of
    select="substring-before(substring-after($word,$beginPre),$endPre)"/>
    <xsl:value-of select="$endPre"/>
  </pre>
  <xsl:call-template name="br-replace">
    <xsl:with-param name="word">
      <xsl:copy-of select="substring-after($word,$endPre)"/>
    </xsl:with-param>
  </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
  <xsl:call-template name="br-replace">
    <xsl:with-param name="word">
      <xsl:copy-of select="$word"/>
    </xsl:with-param>
  </xsl:call-template>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>