<?xml version='1.0'?>
<!-- @(#)xslspec.xsl 1.3 99/01/11 SMI; Style Sheet for the XML and XSL Recommendations and Working Drafts; written by Eduardo Gutentag -->
<!-- Id: xmlspec.xsl,v 1.22 1999/09/04 10:13:53 jjc Exp  Hacked by James Clark -->
<!-- $Id: xmlspec.xsl,v 1.18 2000/07/26 22:05:58 ht Exp $ Modified by HST -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY copy   "&#169;">
<!ENTITY nbsp   "&#160;">
<!ENTITY reg "&#174;">
]>
<!-- XSL Style sheet, DTD omitted -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/>

<xsl:param name="w3">http://www.w3.org/</xsl:param>
<!--
+++++++++++++++++++++++++

Inclusions

+++++++++++++++++++++++++
-->

<xsl:template match="spec" mode="css">
<xsl:text>code { font-family: monospace }</xsl:text>
</xsl:template>

<!--
*******************************************************************

Basic framework to format W3C specs (as in the XML spec)

*******************************************************************
-->
	<xsl:template match="spec">
		<html>
		<head>
		<title>
		<xsl:value-of select="header/title"/>
		</title>
		<link rel="stylesheet" type="text/css" href="{$w3}StyleSheets/TR/W3C-{substring-before(header/w3c-designation,'-')}"/>
		<!-- This stops Netscape 4.5 from messing up. -->
		<style type="text/css">
                <xsl:apply-templates select="." mode="css"/>
                </style>
		</head>
		<body>
			<xsl:apply-templates/>
		</body>
		</html>
	</xsl:template>
<!-- 
*******************************************************************

Prologue

*******************************************************************
-->

        <xsl:template match="header">
                <div class="head">
                        <a href="http://www.w3.org/">
			  <img src="{$w3}Icons/WWW/w3c_home" alt="W3C" height="48" width="72"/>
                        </a>
			<h1>
                            <xsl:value-of select="title"/>
			    
                            <!-- <br/> <xsl:value-of select="version"/> -->
                        </h1>
                        <h2>
				<xsl:value-of select="w3c-doctype"/>
				<xsl:text> </xsl:text>
				<xsl:value-of select="pubdate/day"/>
				<xsl:text> </xsl:text>
				<xsl:value-of select="pubdate/month"/>
				<xsl:text> </xsl:text>
				<xsl:value-of select="pubdate/year"/>
			</h2>
                        <dl>
                        	<xsl:apply-templates select="publoc"/>
		                <xsl:apply-templates select="latestloc"/>
                		<xsl:apply-templates select="prevlocs"/>
                		<xsl:apply-templates select="authlist"/>
                	</dl>
                	<xsl:call-template name="copyright"/>
                	<hr title="Separator for header"/>
                </div>
		<xsl:apply-templates select="abstract"/>
		<xsl:apply-templates select="status"/>
        </xsl:template>

        <!-- HST: hack to get around DTD problem -->
	<xsl:template match="publoc">
		<dt>This version:</dt>
	        <dd><xsl:apply-templates/>
                    <xsl:apply-templates select="../notice[@role=&quot;publoc&quot;]/p/*|../notice[@role=&quot;publoc&quot;]/p/text()"/></dd>
	</xsl:template>
	<xsl:template match="publoc/loc|latestloc/loc|prevlocs/loc">
			<a href="{@href}"><xsl:apply-templates/></a>
			<br/>
	</xsl:template>
	<xsl:template match="latestloc">
		<dt>Latest version:</dt>
	        <dd><xsl:apply-templates/></dd>
	</xsl:template>

	<xsl:template match="prevlocs">
		<dt>
                  <xsl:text>Previous version</xsl:text>
                  <xsl:if test="count(loc)>1">s</xsl:if>
		  <xsl:text>:</xsl:text>
                </dt>
                <dd><xsl:apply-templates/></dd>
	</xsl:template>
	<xsl:template match="authlist">
		<dt>
                  <xsl:text>Editor</xsl:text>
                  <xsl:if test="count(author)>1">s</xsl:if>
		  <xsl:text>:</xsl:text>
                </dt>
		<dd> <xsl:apply-templates/></dd>
	</xsl:template>
	<xsl:template match="author">
		<xsl:apply-templates/>
		<br/>
	</xsl:template>

	<xsl:template match="author/name">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="author/affiliation">
		<xsl:text> (</xsl:text>
			<xsl:apply-templates/>
		<xsl:text>) </xsl:text>
	</xsl:template>

	<xsl:template match="author/email">
		<a href="{@href}">
			<xsl:text>&lt;</xsl:text>
				<xsl:apply-templates/>
			<xsl:text>&gt;</xsl:text>
		</a>
	</xsl:template>

	<xsl:template match="abstract">
		<h2><a name="abstract">Abstract</a></h2>
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="status">
		<h2><a name="status">Status of this document</a></h2>
		<xsl:apply-templates/>
	</xsl:template>
		
<!-- 
*******************************************************************

Real body work

*******************************************************************
-->

	<xsl:template match="body">
		<h2><a name="contents">Table of contents</a></h2>
		<xsl:call-template name="toc"/>
		<hr/>
		<xsl:apply-templates/>
	</xsl:template>

<!-- HST: added open_issues -->
	<xsl:template match="back">
	<hr title="Separator from footer"/>
             <div class="appendices">
               <xsl:apply-templates/>
             </div>
             <div class="issues">
               <xsl:call-template name="open_issues"/>
             </div>
	</xsl:template>

<!-- HST: placeholders for divs -->
        <xsl:template match="div1|div2|div3|div4">
          <div><xsl:attribute name="class"><xsl:value-of select="name()"/></xsl:attribute><xsl:apply-templates/></div>
        </xsl:template>

	<xsl:template match="div1/head|inform-div1/head">
		<h2><xsl:call-template name="head"/></h2>
	</xsl:template>

	<xsl:template match="div2/head">
		<h3><xsl:call-template name="head"/></h3>
	</xsl:template>

	<xsl:template match="div3/head">
		<h4><xsl:call-template name="head"/></h4>
	</xsl:template>

	<xsl:template match="div4/head">
		<h5><xsl:call-template name="head"/></h5>
	</xsl:template>

        <xsl:template name="head">
                <xsl:for-each select="..">
			<xsl:call-template name="insertID"/>
                	<xsl:apply-templates select="." mode="number"/>
                </xsl:for-each>
		<xsl:apply-templates/>
                <xsl:call-template name="inform"/>
        </xsl:template>

<!-- 
*******************************************************************

Blocks

*******************************************************************
-->
<!-- HST: why???	<xsl:template match="item/p" priority="1">
	<p>
		<xsl:apply-templates/>
	</p>
	</xsl:template> -->

	<xsl:template match="p">
		<p>
			<xsl:apply-templates/>
		</p>
	</xsl:template>

        <!-- HST: try to cope: DTD allows nesting of blocks within p -->
        <xsl:template match="p[p|ulist|olist|slist|glist|orglist|blist|note|issue|wfcnote|vcnote|constraintnote]">
         <xsl:call-template name="blocks">
          <xsl:with-param name="nodes" select="*|text()"/>
         </xsl:call-template>
        </xsl:template>

        <xsl:template name="blocks">
         <xsl:param name="nodes"/>
         <xsl:if test="$nodes[position()=1]">
          <xsl:choose>
           <!-- blocks go through unchanged -->
           <xsl:when test="$nodes[position()=1 and (self::p or self::ulist or self::olist or self::slist or self::glist or self::orglist or self::blist or self::note or self::issue or self::wfcnote or self::vcnote or self::constraintnote)]">
            <xsl:apply-templates select="$nodes[position()=1]"/>
            <xsl:call-template name="blocks">
             <xsl:with-param name="nodes" select="$nodes[position()>1]"/>
            </xsl:call-template>
           </xsl:when>
           <xsl:otherwise>
           <!-- text or mixins get joined together and wrapped in <p>..</p> -->
              <p>
               <xsl:apply-templates select="$nodes[position()=1]"/>
               <xsl:call-template name="mixins">
                <xsl:with-param name="nodes" select="$nodes[position()>1]"/>
               </xsl:call-template>
              </p>
              <!-- need position of first block, if any, but don't see
                   how to get it, so use recursion again. -->
               <xsl:call-template name="findblock">
                <xsl:with-param name="nodes" select="$nodes[position()>1]"/>
               </xsl:call-template>
           </xsl:otherwise>
          </xsl:choose>
         </xsl:if>
         </xsl:template>

        <xsl:template name="mixins">
         <xsl:param name="nodes"/>
         <xsl:if test="$nodes[position()=1]">
          <xsl:choose>
           <xsl:when test="$nodes[position()=1 and (self::p or self::ulist or self::olist or self::slist or self::glist or self::orglist or self::blist or self::note or self::issue or self::wfcnote or self::vcnote or self::constraintnote)]">
           </xsl:when>
          <xsl:otherwise>
           <xsl:apply-templates select="$nodes[position()=1]"/>
           <xsl:call-template name="mixins">
            <xsl:with-param name="nodes" select="$nodes[position()>1]"/>
           </xsl:call-template>
         </xsl:otherwise>
        </xsl:choose>
        </xsl:if>
        </xsl:template>
           
        <xsl:template name="findblock">
         <xsl:param name="nodes"/>
         <xsl:if test="$nodes[position()=1]">
          <xsl:choose>
           <xsl:when test="$nodes[position()=1 and (self::p or self::ulist or self::olist or self::slist or self::glist or self::orglist or self::blist or self::note or self::issue or self::wfcnote or self::vcnote or self::constraintnote)]">
             <xsl:call-template name="blocks">
              <xsl:with-param name="nodes" select="$nodes"/>
             </xsl:call-template>
           </xsl:when>
          <xsl:otherwise>
           <xsl:call-template name="findblock">
            <xsl:with-param name="nodes" select="$nodes[position()>1]"/>
           </xsl:call-template>
          </xsl:otherwise>
        </xsl:choose>
       </xsl:if>
        </xsl:template>

	<xsl:template match="eg" name="egbody">
		<pre>
                        <xsl:if test="@role='error'">
                            <xsl:attribute name="style">color: red</xsl:attribute>
                        </xsl:if>
                        <xsl:choose>
                         <xsl:when test="@text">
                          <xsl:value-of select="document(@text)"/>
                         </xsl:when>
			<xsl:otherwise>
                         <xsl:apply-templates/>
                        </xsl:otherwise>
</xsl:choose>
		</pre>
	</xsl:template>

	<xsl:template match="htable">
		<table border="{@border}" cellpadding="{@cellpadding}" align="{@align}">
			<xsl:apply-templates/>
		</table>
	</xsl:template>

	<xsl:template match="htbody">
		<tbody>
			<xsl:apply-templates/>
		</tbody>
	</xsl:template>

	<xsl:template match="tr">
		<tr align="{@align}" valign="{@valign}">
			<xsl:apply-templates/>
		</tr>
	</xsl:template>

	<xsl:template match="td">
		<td bgcolor="{@bgcolor}" rowspan="{@rowspan}" colspan="{@colspan}" align="{@align}" valign="{@valign}">
			<xsl:apply-templates/>
		</td>
	</xsl:template>

	<xsl:template match="ednote">
		<blockquote>
		<p><b>Ed. Note: </b><xsl:apply-templates/></p>
		</blockquote>
	</xsl:template>

	<xsl:template match="edtext">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="issue">
		<xsl:call-template name="insertID"/>
		<blockquote>
			<p>
			<b>Issue (<xsl:value-of select="substring-after(@id,'-')"/>): </b>
			<xsl:apply-templates/>
			</p>
		</blockquote>
	</xsl:template>


	<xsl:template match="note">
	<blockquote>
		<b>NOTE: </b>
		<xsl:apply-templates/>
	</blockquote>
	</xsl:template>

        <!-- HST: added def/p -->
	<xsl:template match="issue/p|note/p|def/p|item/p|constraintnote/p">
	<xsl:apply-templates/>
	</xsl:template>

         <!-- HST: some space between p in these contexts -->
         <xsl:template match="issue/p[following-sibling::*[1][self::p]]|
                          note/p[following-sibling::*[1][self::p]]|
                          constraintnote/p[following-sibling::*[1][self::p]]|
                          item/p[following-sibling::*[1][self::p]]|
                          def/p[following-sibling::*[1][self::p]]">
          <xsl:apply-templates/>
          <p/>
         </xsl:template>

<!-- 
*******************************************************************

Productions

*******************************************************************
-->
	<xsl:template match="scrap">
                <xsl:if test="string(head)">
		  <h5><xsl:value-of select="head"/></h5>
                </xsl:if>
		<table class="scrap">
		<tbody>
		<xsl:apply-templates select="prodgroup|prod"/>
		</tbody>
		</table>
	</xsl:template>


	<xsl:template match="prod">
	    <!-- select elements that start a row -->
	    <xsl:apply-templates select="
*[self::lhs
  or (self::vc or self::wfc or self::com
      and not(preceding-sibling::*[1][self::rhs]))
  or (self::rhs
      and not(preceding-sibling::*[1][self::lhs]))]
"/>
	</xsl:template>

       <!-- HST: numbering sensitive to role="prefig" -->
       <!-- HST: productions use <code> throughout, as per the XML 1.0 spec -->
	<xsl:template match="lhs">
		<tr valign="baseline">
		<td><a name="{../@id}"/>
            <xsl:if test="ancestor::prod[not(@role=&quot;prefig&quot;)]"><code>
		<xsl:number from="body" level="any" format="[1]&nbsp;&nbsp;&nbsp;" count="lhs[ancestor::prod[not(@role=&quot;prefig&quot;)]]"/>
                 </code></xsl:if>
		</td>
		<td><code><xsl:apply-templates/></code></td>
		<td><code><xsl:text>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</xsl:text></code></td>
		<xsl:for-each select="following-sibling::*[1]">
		  <td><code><xsl:apply-templates mode="cell" select="."/></code></td>
		  <td><xsl:apply-templates mode="cell" select="following-sibling::*[1][self::vc or self::wfc or self::com]"/></td>
		</xsl:for-each>
		</tr>
	</xsl:template>

	<xsl:template match="rhs">
		<tr valign="baseline">
                  <td></td>
                  <td></td>
		  <td></td>
		  <td><code><xsl:apply-templates mode="cell" select="."/></code></td>
		  <td><xsl:apply-templates mode="cell" select="following-sibling::*[1][self::vc or self::wfc or self::com]"/></td>
		</tr>
	</xsl:template>

	<xsl:template match="vc|wfc|com">
		<tr valign="baseline">
                  <td></td>
                  <td></td>
		<td></td>
		<td></td>
		<td><xsl:apply-templates mode="cell" select="."/></td>
		</tr>
	</xsl:template>


	<xsl:template match="prodgroup">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="com" mode="cell">
		<xsl:text>/*</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>*/</xsl:text>
	</xsl:template>

	<xsl:template match="rhs" mode="cell">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="vc" mode="cell">
		<xsl:text>[&nbsp;VC:&nbsp;</xsl:text>
	<a href="#{@def}">
		<xsl:value-of select="id(@def/head)"/>
	</a>
		<xsl:text>&nbsp;]</xsl:text>
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="wfc" mode="cell">
		<xsl:text>[&nbsp;WFC:&nbsp;</xsl:text>
	<a href="#{@def}">
		<xsl:value-of select="id(@def)/head"/>
	</a>
		<xsl:text>&nbsp;]</xsl:text>
		<xsl:apply-templates/>
	</xsl:template>
<!-- 
*******************************************************************

References

*******************************************************************
-->
	<xsl:template match="p/loc" priority="1">
		<a href="{@href}"><xsl:apply-templates/></a>
	</xsl:template>

	<xsl:template match="publoc/loc|latestloc/loc|prevlocs/loc">
		<a href="{@href}"><xsl:apply-templates/></a>
		<br/>
	</xsl:template>

	<xsl:template match="loc">
		<a href="{@href}"><xsl:apply-templates/></a>
	</xsl:template>


	<xsl:template match="bibref">
		<a href="#{@ref}">
		<xsl:text>[</xsl:text>
		<xsl:value-of select="id(@ref)/@key"/>
		<xsl:apply-templates/>
		<xsl:text>]</xsl:text>
		</a>
	</xsl:template>

	<xsl:template match="specref">
		<a href="#{@ref}">
		<xsl:text>[</xsl:text>
		<b>
                <xsl:for-each select="id(@ref)/head">
                        <xsl:apply-templates select=".." mode="number"/>
                        <xsl:apply-templates/>
		</xsl:for-each>
		</b>
		<xsl:apply-templates/>
		<xsl:text>]</xsl:text>
		</a>
	</xsl:template>
	<xsl:template match="termref">
		<a href="#{@def}">
		<xsl:apply-templates/>
		</a>
	</xsl:template>

        <xsl:template match="xtermref">
                <a class="xtermref" href="{@href}"><xsl:apply-templates/></a>
        </xsl:template>

	<xsl:template match="titleref">
		<a href="#{@href}">
		<xsl:apply-templates/>
		</a>
	</xsl:template>
 
 <xsl:template match="propref" name="propref">
  <xsl:param name="ob">[</xsl:param>
  <xsl:param name="cb">]</xsl:param>
    <a href="#{@ref}"><xsl:value-of select="$ob"/><xsl:value-of select="id(@ref)/@name"/><xsl:value-of select="$cb"/></a>
 </xsl:template>
 
 <xsl:template match="xpropref" name="xpropref">
  <xsl:param name="ob">[</xsl:param>
  <xsl:param name="cb">]</xsl:param>
  <xsl:choose>
   <xsl:when test="@href">
    <a href="{@href}"><xsl:value-of select="$ob"/><xsl:apply-templates/><xsl:value-of select="$cb"/></a>
   </xsl:when>
   <xsl:otherwise>
    <strong><xsl:value-of select="$ob"/><xsl:apply-templates/><xsl:value-of select="$cb"/></strong>
   </xsl:otherwise>
  </xsl:choose>    
 </xsl:template>
 
 <xsl:template match="propdef" name="propdef">
  <xsl:param name="ob">[</xsl:param>
  <xsl:param name="cb">]</xsl:param>
    <dt><a name="{@id}"><xsl:value-of select="$ob"/><xsl:value-of select="@name"/><xsl:value-of select="$cb"/></a></dt>
  <dd><xsl:apply-templates/></dd>
 </xsl:template>

	<xsl:template match="termdef">
		<a name="{@id}">
		</a>
			<xsl:apply-templates/>
	</xsl:template>


	<xsl:template match="vcnote">
		<a name="{@id}"></a>
		<p><b>Validity Constraint: <xsl:value-of select="head"/></b></p>
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="wfcnote">
		<a name="{@id}"></a>
		<p><b>Well Formedness Constraint: <xsl:value-of select="head"/></b></p>
		<xsl:apply-templates/>
	</xsl:template>

<!-- 
*******************************************************************

Inlines

*******************************************************************
-->
	<xsl:template match="termdef">
		<a name="{@id}">
		</a>
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="term">
		<b><xsl:apply-templates/></b>
	</xsl:template>

	<xsl:template match="orglist/member[1]" priority="2">
		<xsl:apply-templates select="*"/>
	</xsl:template>

	<xsl:template match="orglist/member">
	        <xsl:text>; </xsl:text>
		<xsl:apply-templates select="*"/>
	</xsl:template>
	
	<xsl:template match="orglist/member/name">
                 <xsl:apply-templates/>
        </xsl:template>

	<xsl:template match="orglist/member/affiliation">
                 <xsl:text>, </xsl:text>
                 <xsl:apply-templates/>
        </xsl:template>

	<xsl:template match="orglist/member/role">
			<xsl:text> (</xsl:text>
			<xsl:apply-templates/>
			<xsl:text>)</xsl:text>
	</xsl:template>

	<xsl:template match="code">
		<code>
			<xsl:apply-templates/>
		</code>
	</xsl:template>

	<xsl:template match="emph">
		<i>
			<xsl:apply-templates/>
		</i>
	</xsl:template>
<!-- 
*******************************************************************

Lists

*******************************************************************
-->
	<xsl:template match="blist">
	<dl>
		<xsl:apply-templates/>
	</dl>
	</xsl:template>

	<xsl:template match="slist">
	<ul>
		<xsl:apply-templates/>
	</ul>
	</xsl:template>
	<xsl:template match="sitem">
	<li>
		<xsl:apply-templates/>
	</li>
	</xsl:template>

	<xsl:template match="blist/bibl">
		<dt><b>
			<a name="{@id}">
			<xsl:value-of select="@key"/>
			</a>
		</b></dt>
		<dd>
			<xsl:apply-templates/>
		</dd>
	</xsl:template>

	<xsl:template match="olist">
	<ol>
		<xsl:apply-templates/>
	</ol>
	</xsl:template>

	<xsl:template match="ulist">
	<!--
	<ul type="circle">
	-->
	<ul>
		<xsl:apply-templates/>
	</ul>
	</xsl:template>

	<xsl:template match="glist">
		<dl>
			<xsl:apply-templates/>
		</dl>
	</xsl:template>

        <!-- HST: for completeness -->
        <xsl:template match="gitem">
          <xsl:apply-templates/>
        </xsl:template>

	<xsl:template match="item">
	<li>
		<xsl:apply-templates/>
	</li>
	</xsl:template>

	<xsl:template match="label">
	<dt>
		<b><xsl:apply-templates/></b>
	</dt>
	</xsl:template>

	<xsl:template match="def">
	<dd>
		<xsl:apply-templates/>
	</dd>
	</xsl:template>

	<xsl:template match="orglist">
		<xsl:apply-templates select="*"/>
	</xsl:template>


	<xsl:template match="olist">
	<ol>
		<xsl:apply-templates/>
	</ol>
	</xsl:template>


<!-- 
*******************************************************************

Empty templates

*******************************************************************
-->
	<xsl:template match="w3c-designation">
	</xsl:template>

	<xsl:template match="w3c-doctype">
	</xsl:template>

	<xsl:template match="header/pubdate">
	</xsl:template>


	<xsl:template match="spec/header/title">
	</xsl:template>

	<xsl:template match="revisiondesc">
	</xsl:template>
	
	<xsl:template match="pubstmt">
	</xsl:template>

	<xsl:template match="sourcedesc">
	</xsl:template>

	<xsl:template match="langusage">
	</xsl:template>

	<xsl:template match="version">
	</xsl:template>
<!-- 
*******************************************************************

Macros


*******************************************************************
-->
<!-- HST: IE5 doesn't support the 'smaller' in the stylesheet, this
          works there and in Netscape . . . -->
<!-- HST: taken from http://www.w3.org/Guide/Reports.html#ipr 1999-12-17 -->
	<xsl:template name="copyright">
	<p><small><A href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"> Copyright</A>
&copy;1999, 2000 <A href="http://www.w3.org/"><abbr title="World Wide Web
Consortium">W3C</abbr></A><sup>&reg;</sup> (<A href="http://www.lcs.mit.edu/"><abbr title="Massachusetts
Institute of Technology">MIT</abbr></A>, <A href="http://www.inria.fr/"><abbr lang="fr" title="Institut
National de Recherche en Informatique et Automatique">INRIA</abbr></A>, <A href="http://www.keio.ac.jp/">Keio</A>), All Rights Reserved. W3C <A href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</A>, <A href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</A>, <A href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</A> and <A href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</A> rules
apply.</small></p>
	</xsl:template>

	<xsl:template name="toc">
		<xsl:for-each select="/spec/body/div1">
				<xsl:call-template name="makeref"/>
				<br/>

				<xsl:for-each select="div2">
					<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
					<xsl:call-template name="makeref"/>
					<br/>
						<xsl:for-each select="div3">
							<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
								<xsl:call-template name="makeref"/>
							<br/>
       <xsl:for-each select="div4">
							<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
								<xsl:call-template name="makeref"/>
							<br/>
						</xsl:for-each>
						</xsl:for-each>
				</xsl:for-each>
		</xsl:for-each>

		<h3>Appendices</h3>

		<xsl:for-each select="/spec/back/div1 | /spec/back/inform-div1">
				<xsl:call-template name="makeref"/>
				<br/>

				<xsl:for-each select="div2">
						<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
						<xsl:call-template name="makeref"/>
						<br/>

						<xsl:for-each select="div3">
								<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
								<xsl:call-template name="makeref"/>
								<br/>
						</xsl:for-each>
				</xsl:for-each>
		</xsl:for-each>
	</xsl:template>

	<xsl:template name="insertID">
		<xsl:choose>
			<xsl:when test="@id">
				<a name="{@id}"/>
			</xsl:when>
			<xsl:otherwise>
				<a name="section-{translate(head,' ','-')}"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="makeref">
                <xsl:apply-templates select="." mode="number"/>
		<xsl:choose>
			<xsl:when test="@id">
				<a href="#{@id}">
					<xsl:value-of select="head"/>
				</a>
			</xsl:when>
			<xsl:otherwise>
				<a href="#section-{translate(head,' ','-')}">
					<xsl:value-of select="head"/>
				</a>
			</xsl:otherwise>
		</xsl:choose>
                <xsl:for-each select="head">
                  <xsl:call-template name="inform"/>
                </xsl:for-each>
	</xsl:template>

        <!-- HST: added this back, hack is to get around stack overflow under
                  WIN32 -->
	<xsl:template name="open_issues">
            <xsl:for-each select="../body/div1//issue">
                 <a class="issue" href="#{@id}">
                   <xsl:value-of select="@id"/>
                 </a>
                 <br/>
            </xsl:for-each>
        </xsl:template>

        <xsl:template name="inform">
           <xsl:if test="parent::inform-div1">
              <xsl:text> (Non-Normative)</xsl:text>
           </xsl:if>
        </xsl:template>

	<xsl:template match="nt">
		<a href="#{@def}"><xsl:apply-templates/></a>
        </xsl:template>

	<xsl:template match="xnt">
		<a href="{@href}"><xsl:apply-templates/></a>
        </xsl:template>

	<xsl:template match="quote">
		<xsl:text>"</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>"</xsl:text>
	</xsl:template>
	
	<xsl:template mode="number" match="back//*">
           <xsl:number level="multiple" count="inform-div1|div1|div2|div3|div4" format="A.1 "/>
        </xsl:template>
	<xsl:template mode="number" match="*">
           <xsl:number level="multiple" count="inform-div1|div1|div2|div3|div4" format="1.1 "/>
        </xsl:template>

</xsl:stylesheet>

