<?xml version='1.0'?>
<!-- Wrapper for xmlspec.xsl for XML Schema part 1 -->
<!-- Henry S. Thompson 1999-05-10 -->
<!-- XSL Style sheet, DTD omitted -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY sect   "&#xa7;">
<!ENTITY nbsp   "&#160;">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
 
 <xsl:strip-space elements="xsd:*"/>
 

 <!-- highlight unprocessed tags -->
 <xsl:template match="*"><SPAN STYLE="color:GREEN"><xsl:attribute name="TITLE"><xsl:value-of select="name()"/></xsl:attribute><xsl:apply-templates/></SPAN></xsl:template>

 <xsl:import href="xmlspec.xsl"/> 

  <!-- Get and stash schema and schema dump, if present.
       Two stages because we need to establish context for
       unparsed-entity-uri as the input document -->
 <xsl:variable name="sdf">
  <xsl:for-each select="/">
   <xsl:value-of select="unparsed-entity-uri('schemaDump')"/>
  </xsl:for-each>
 </xsl:variable>
 
 <xsl:variable name="sd">
  <xsl:for-each select="/">
   <xsl:value-of select="unparsed-entity-uri('schemaProper')"/>
  </xsl:for-each>
 </xsl:variable>
 
 <xsl:variable name="sde">
  <xsl:for-each select="/">
   <xsl:value-of select="unparsed-entity-uri('schemaExample')"/>
  </xsl:for-each>
 </xsl:variable>
 
 <xsl:variable name="schemaDump" select="document($sdf)/*"/>
 <xsl:variable name="schemaProper" select="document($sd)/*"/>
 <xsl:variable name="schemaExample" select="document($sde)/*"/>
 
 <xsl:variable name="datatypeURL">
  <xsl:value-of select="/spec/back/div1[4]/blist/bibl[@id='ref-xsp2']/loc/@href"/>
 </xsl:variable>
 
 <xsl:template match="stale">
  <p class="stale">
<xsl:text>[Unrestructured material elided]</xsl:text>
  </p><!-- [Begin unrestructured material:
  <div class="stale">
   <xsl:apply-templates/>
  </div>
  <p class="stale">
<xsl:text>End unrestructured material]</xsl:text>
  </p>-->
 </xsl:template>

<!-- Override - - always empty and single in xmlschema-1,
     section numbers after in ()s -->
<!-- Check print for underline, else bold -->
 <xsl:template match="specref" name="specref">
  <xsl:param name="ref"><xsl:value-of select="@ref"/></xsl:param>
		<a href="#{$ref}">
                <xsl:value-of select="id($ref)/head"/>
		<xsl:text> (&sect;</xsl:text>
                <xsl:for-each select="id($ref)">
		<xsl:choose>
		<xsl:when test="ancestor::back">
			<xsl:number level="multiple" count="inform-div1|div1|div2|div3|div4" format="A.1"/>
		</xsl:when>
		<xsl:when test="ancestor::body">
			<xsl:number level="multiple" count="div1|div2|div3|div4" format="1.1"/>
		</xsl:when>
                </xsl:choose>
                </xsl:for-each>
		<xsl:text>)</xsl:text>
		</a>
 </xsl:template>

<!-- Override to get our Definition style in and
     override (W3C CSS) stylesheet's PRE indent -->
	<xsl:template match="spec">
		<html>
		<head>
		<title>
		<xsl:value-of select="header/title"/>
		</title>
		<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD"/>
		<!-- This stops Netscape 4.5 from messing up. -->
		<style type="text/css">
                   code { font-family: monospace}
                   .termdef {color: rgb(133,0,033)}
                   PRE {MARGIN-LEFT: 0em}
                   dl.props {margin-bottom: 0em}   
                   div.stale {color:gray}
                   div.stale td {color:gray}
                   div.stale a:link {color:gray}
                   div.stale a:visited {color:gray}
                   div.stale a:active {color:gray}
                   div.stale span {color:gray}
                   p.stale {color:red}
                   p.element-syntax { border: solid thin;
                                      font-family: monospace}
                   div.constraint {
                      margin-left: 1em; 
                   }
                   table.constraintlist {
                      border:none; 
                      border-spacing:2
                      margin-left:1%;
                   }
                   td.clnumber {
                      vertical-align:top; }
                   table.schemaComp { margin-left: 2em; margin-right: 2em; }
                   table.restricts { margin-top: 1em; margin-bottom: 1em; }
                </style>
		</head>
		<body>
			<xsl:apply-templates/>
		</body>
		</html>
	</xsl:template>


	<!-- Override to get extra text -->
        <xsl:template match="termdef">
             <span class="termdef">
               <a name="{@id}"><xsl:text>[Definition:]&nbsp;&nbsp;</xsl:text></a>
               <xsl:apply-templates/>
             </span>
        </xsl:template>

        <!-- override to get header inside box -->
        <xsl:template match="scrap">
             <div class="scrap">
             <table cellpadding="5" border="1" bgcolor="#f5dcb3" width="100%">
                <tbody>
                  <tr align="left">
                    <td>
                      <strong>
                      <font color="red"><xsl:value-of select="head"/></font>
                      </strong>
                    </td>
                   </tr>
                   <tr><td><table border="0" bgcolor="#f5dcb3"><tbody>
	          <xsl:apply-templates select="prodgroup|prod"/>
                   </tbody></table></td></tr>
                </tbody>
              </table>
              </div>
        </xsl:template>

<!-- special treatment for special common case:  eg inside note -->
        <xsl:template match="note[@role=&quot;example&quot;]|note[eg]">
          <blockquote class="example">
           <table border="1">
                  <tbody>
                    <tr align="left">
                      <td><strong><font color="blue">Example</font></strong></td>
                    </tr>
                    <tr>
                      <td>
                        <table border="0">
                          <tbody><xsl:apply-templates mode="egnote"/></tbody>
                        </table>
                      </td>
                    </tr>
                 </tbody>
             </table>
           </blockquote>
         </xsl:template>

        <xsl:template match="eg" mode="egnote">
        <tr><td><div class="eg">
<table cellpadding="5" border="1" bgcolor="#80ffff" width="100%">
       <tr><td>
                <xsl:call-template name="egbody"/>
                  
        </td></tr>
        </table>
        </div></td></tr>
        </xsl:template>

        <xsl:template match="*" mode="egnote">
          <tr><td><xsl:apply-templates select="."/></td></tr>
        </xsl:template>

        <xsl:template match="B">
                <b><xsl:apply-templates/></b>
        </xsl:template>
<!-- **************************************************************** -->
<!-- Tables -->
<!-- **************************************************************** -->
<!-- 
     Tables

     just copy over the entire subtree, as is
     except that the children of TD, TH and CAPTION are possibly handled by
     other templates in this stylesheet
  -->
<xsl:template match="table|caption|thead|tfoot|tbody|colgroup|col|tr|th|td">
   <xsl:element name="{name()}">
      <xsl:apply-templates select="* | @* | text()"/>
   </xsl:element>
</xsl:template>

<xsl:template match="
	table/@* |
	thead/@* |
	tfoot/@* |
	tbody/@* |
	colgroup/@* |
	col/@* |
	tr/@* |
	th/@* |
	td/@*">
   <xsl:copy>
      <xsl:apply-templates/>
   </xsl:copy>
</xsl:template>

        <!-- We do this differently from James -->
        <xsl:template match="rhs/com">
             <i class="com"><xsl:apply-templates/></i>
        </xsl:template>

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


<!-- 'Choose' cases for XSDL spec  -->
        <xsl:template match="constraintnote">
             <div class="constraintnote">
               <a name="{@id}"></a>
               <b>
                 <xsl:choose>
                      <xsl:when test="@type=&quot;cos&quot;">
                          <xsl:text>Constraint on Schemas:  </xsl:text>
                      </xsl:when>
                  <xsl:when test="@type=&quot;src&quot;">
                          <xsl:text>Schema Representation Constraint:  </xsl:text>
                      </xsl:when>
                      <xsl:when test="@type=&quot;cvc&quot;">
                          <xsl:text>Validation Contribution:  </xsl:text>
                      </xsl:when>
                      <xsl:when test="@type=&quot;sic&quot;">
                          <xsl:text>Schema Information Set Contribution:  </xsl:text>
                      </xsl:when>
                      <xsl:otherwise>Constraint:  </xsl:otherwise>
                 </xsl:choose>
               <xsl:value-of select="head"/>
               </b><br/>
               <div class="constraint"><xsl:apply-templates/></div>
               
             </div>
        </xsl:template>

        <!-- Override to avoid stripping prefix (Why does James do this?) -->
	<xsl:template match="issue">
		<xsl:call-template name="insertID"/>
		<blockquote>
			<b>Issue (<xsl:value-of select="@id"/>): </b>
			<xsl:apply-templates/>
		</blockquote>
	</xsl:template>

        <xsl:template match="constraintnote/head"/>
 
 <!-- Our own component definition -->
 
 <xsl:template match="compdef">
  <blockquote class="compdef">
           <table border="1">
            <thead>
             <tr align="left">
              <th>
               <strong><font color="brown">Schema Component</font></strong>
               <xsl:text>:</xsl:text>&nbsp;
               <a href="#{@ref}"><xsl:value-of select="@name"/></a>
              </th>
             </tr>
            </thead>
                  <tbody>             
                   <tr>
                     <td>
                      <xsl:apply-templates/>                      
                     </td></tr>
                 </tbody>
             </table>
           </blockquote>
 </xsl:template>
 
 <xsl:template match="proplist">
  <dl class="props">
                      <xsl:apply-templates/>
                      </dl>
 </xsl:template>
 
 <!-- we use our own brackets -->
 <xsl:template match="propdef">
  <xsl:call-template name="propdef">
   <xsl:with-param name="ob">{</xsl:with-param>
   <xsl:with-param name="cb">}</xsl:with-param>
  </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="propref">
  <xsl:call-template name="propref">
   <xsl:with-param name="ob">{</xsl:with-param>
   <xsl:with-param name="cb">}</xsl:with-param>
  </xsl:call-template>
 </xsl:template>

 <!-- Our own complex abstract data type to concrete syntax mapping display -->
 
 <xsl:template match="reprdef">
  <blockquote class="reprdef">
           <table border="1">
            <thead>
             <tr align="left">
              <th>
               <strong><font color="brown">XML Representation Summary</font></strong>
               <xsl:text>:</xsl:text>&nbsp;
               <code><xsl:value-of select="reprelt[1]/@eltname"/></code>
               <xsl:text>&nbsp;Element Information Item</xsl:text>
              </th>
             </tr>
            </thead>
                  <tbody>
                   <xsl:for-each select="reprelt">
                    <xsl:variable name="name" select="@eltname"/>
                    <tr>
                    <td>
                       <xsl:choose>
                        <xsl:when test="@type">
                         <xsl:variable name="type" select="@type"/>
                         <xsl:call-template name="explicitType">
                          <xsl:with-param name="elt" select="@eltname"/>
                          <xsl:with-param name="typeDef" select="$schemaDump/xsd:complexType[@name=$type]"/>
                         </xsl:call-template>
                        </xsl:when>
                        <xsl:when test="@local">
                         <xsl:variable name="context">
                          <xsl:value-of select="@local"/>
                         </xsl:variable>
                         <xsl:variable name="vn"><xsl:text>!</xsl:text><xsl:value-of select="@eltname"/></xsl:variable>
                         <xsl:apply-templates select="$schemaDump/xsd:element[@name=$context]/xsd:element[@name=$vn]"/>
                        </xsl:when>
                        <xsl:when test="$name='example'">
                         <!-- cheat like h*** -->
                         <xsl:apply-templates select="$schemaExample/xsd:element[@name='example']"/>
                        </xsl:when>
                        <xsl:otherwise>
                         <xsl:apply-templates select="$schemaDump/xsd:element[@name=$name]"/>
                        </xsl:otherwise>
</xsl:choose>
                      
                    </td>
                   </tr></xsl:for-each>
                   <xsl:apply-templates select="reprcomp"/>
                 </tbody>
             </table>
           </blockquote>
 </xsl:template>
 
 <xsl:template match="reprcomp">
  
  <xsl:apply-templates select="reprdep"/>
  <xsl:if test="propmap"><tr><td><table class="reprcomp" border="1">
   <thead>
    <tr>
     <th><a><xsl:attribute name="href">#<xsl:value-of select="@ref"/></xsl:attribute><xsl:value-of select="@abstract"/></a><strong>&nbsp;Schema Component</strong></th>
    </tr>
   </thead>
   <tbody>
    <tr>
     <td>
      <table border="0">
                       <thead>
                        <tr>
                         <th align="left">Property</th>
                         <th align="left">Representation</th>
                        </tr>
                       </thead>
                       <tbody valign="top">
                        <xsl:for-each select="propmap">
                         <tr valign="top">
                          <td>
                           <a><xsl:attribute name="href">#<xsl:value-of select="@name"/></xsl:attribute>{<xsl:value-of select="id(@name)/@name"/>}</a>
                          </td>
                          <td>
                           <xsl:apply-templates/>
                          </td>
                         </tr>
                        </xsl:for-each>
</tbody></table>
     </td>
    </tr>
   </tbody>
  </table></td></tr></xsl:if>
  
 </xsl:template>
 
 <xsl:template match="reprdep">
  <tr>
   <td>
    <xsl:apply-templates/>
   </td>
  </tr>
 </xsl:template>

 <xsl:template match="xsd:element">
  <xsl:call-template name="explicitType">
   <xsl:with-param name="elt" select="@name"/>
   <xsl:with-param name="typeDef" select="xsd:complexType"/>
   <xsl:with-param name="std" select="@type"/>
  </xsl:call-template>
 </xsl:template>
 
 <xsl:template name="explicitType">
  <xsl:param name="elt"/>
  <xsl:param name="typeDef"/>
  <xsl:param name="std"/>
  <p class="element-syntax">
   <a name="element-{$elt}">
    <xsl:text>&lt;</xsl:text>
     <xsl:call-template name="eltname">
      <xsl:with-param name="name">
       <xsl:value-of select="$elt"/>
      </xsl:with-param>
     </xsl:call-template>    
   </a>   
     <xsl:apply-templates select="$typeDef/xsd:attribute"/>
     <xsl:choose>
      <xsl:when test="$typeDef[@content='empty']">
       <br/><xsl:text>/&gt;</xsl:text>
      </xsl:when>
      <xsl:when test="$std">
       <!-- must be a simple type -->
       <xsl:variable name="localDef" select="$schemaProper/xsd:simpleType[@name=$std]"/>
       <xsl:text>&gt;</xsl:text>
<br/>
<em><xsl:text>&nbsp;&nbsp;Content: </xsl:text></em>
       <xsl:value-of select="$std"/>
       <xsl:text>&nbsp;:&nbsp;</xsl:text>
       <xsl:apply-templates select="$localDef"/>
       <br/>
       <xsl:text>&lt;/</xsl:text>
 <xsl:call-template name="eltname">
  <xsl:with-param name="name" select="$elt">
  </xsl:with-param>
 </xsl:call-template>
<xsl:text>&gt;</xsl:text>
      </xsl:when>
      <xsl:otherwise>
       <xsl:apply-templates mode="top" select="$typeDef/xsd:choice|$typeDef/xsd:all|$typeDef/xsd:sequence|$typeDef/xsd:group"/>
       <xsl:text>&lt;/</xsl:text>
 <xsl:call-template name="eltname">
  <xsl:with-param name="name" select="$elt">
  </xsl:with-param>
 </xsl:call-template>
<xsl:text>&gt;</xsl:text>
      </xsl:otherwise>
     </xsl:choose>
   </p></xsl:template>

 <xsl:template name="eltname">
  <xsl:param name="name"/>
  <xsl:choose>
   <xsl:when test="starts-with($name,'!')">
    <xsl:value-of select="substring($name,2)"/>
   </xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="$name"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>

<xsl:template match="xsd:group|xsd:choice|xsd:all|xsd:sequence" mode="top">
<xsl:text>&gt;</xsl:text>
<br/>
<em><xsl:text>&nbsp;&nbsp;Content: </xsl:text></em>
<xsl:apply-templates select="." mode="model"/>
<br/>
</xsl:template>

<xsl:template match="xsd:group|xsd:choice|xsd:all|xsd:sequence" mode="model">
 <xsl:variable name="needParen" select="not(parent::xsd:group) or @minOccurs!='1' or @maxOccurs!='1'"/>
 <xsl:call-template name="group"/>
<xsl:if test="$needParen"><xsl:text>(</xsl:text></xsl:if>
<xsl:apply-templates mode="model"/>
<xsl:if test="$needParen"><xsl:text>)</xsl:text></xsl:if>
<xsl:call-template name="repeat"/>
</xsl:template>


 <xsl:template match="xsd:element" mode="model">
  <xsl:call-template name="group"/>
  <xsl:choose>
   <xsl:when test="@name">
    <xsl:call-template name="eltref">
     <xsl:with-param name="name" select="@name"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="eltref">
     <xsl:with-param name="name" select="@ref"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
<xsl:call-template name="repeat"/>
</xsl:template>
 
 <xsl:template name="eltref">
  <xsl:param name="name"/>
  <a href="#element-{$name}">
   <xsl:value-of select="$name"/>
  </a>
 </xsl:template>
 
 <xsl:template match="eltref">
  <xsl:call-template name="eltref">
     <xsl:with-param name="name" select="@ref"/>
    </xsl:call-template>
 </xsl:template>

<xsl:template name="group">
<xsl:if test="position()>1">
<xsl:choose>
<xsl:when test="parent::xsd:sequence"><xsl:text> , </xsl:text></xsl:when>
<xsl:when test="parent::xsd:choice"><xsl:text> | </xsl:text></xsl:when>
<xsl:when test="parent::xsd:all"><xsl:text> &amp; </xsl:text></xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>

<xsl:template name="repeat">
  <xsl:choose>
   <xsl:when test="@minOccurs='1' and @maxOccurs='unbounded'">
    <xsl:text>+</xsl:text>
   </xsl:when>
   <xsl:when test="@minOccurs='0' and @maxOccurs='unbounded'">
    <xsl:text>*</xsl:text>
   </xsl:when>
   <xsl:when test="@minOccurs='0'">
    <xsl:text>?</xsl:text>
   </xsl:when>
  </xsl:choose>
</xsl:template>


<xsl:template match="xsd:attribute[not(@use='prohibited')]">
<br/>

<xsl:text>&nbsp;&nbsp;</xsl:text>
<xsl:choose>
<xsl:when test="@use='required'">
<b><xsl:value-of select="@name"/></b>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text> = </xsl:text>
<xsl:if test="@type">
 <xsl:variable name="type" select="@type"/>
 <xsl:variable name="localDef" select="$schemaProper/xsd:simpleType[@name=$type]"/>
 <xsl:choose>
  <xsl:when test="$localDef">
   <xsl:apply-templates select="$localDef"/>
  </xsl:when>
  <xsl:otherwise>
   <a href="{$datatypeURL}#{@type}"><xsl:value-of select="@type"/></a>
  </xsl:otherwise>
 </xsl:choose> 
</xsl:if>
<xsl:apply-templates/>
 <xsl:if test="@use='default' or @use='fixed'">
  <xsl:text>&nbsp;:&nbsp;</xsl:text>
  <xsl:choose>
   <xsl:when test="@value=&quot;&quot;">
    <xsl:text>''</xsl:text>
   </xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="@value"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:if>
</xsl:template>
 
 <xsl:template match="xsd:simpleType[xsd:enumeration]">
  <xsl:apply-templates select="xsd:enumeration"/>
 </xsl:template>
 
 <xsl:template match="xsd:simpleType[xsd:annotation/xsd:documentation and not(xsd:enumeration)]">
  <!-- This is a hack to cope with utility types with no real definition -->
  <em><xsl:value-of select="xsd:annotation/xsd:documentation[1]"/></em>
 </xsl:template>

<xsl:template match="xsd:enumeration">
<xsl:if test="position()>1"> | </xsl:if>
<var><xsl:value-of select="@value"/></var>
</xsl:template>

<xsl:template match="constant">
<xsl:if test="position()>1"> | </xsl:if>
<xsl:text>"</xsl:text>
<xsl:value-of select="@value"/>
<xsl:text>"</xsl:text>
</xsl:template>

 <xsl:template match="schemaComp">
  <table class="schemaComp" border="1">
   <thead>
    <tr>
     <th><strong><xsl:value-of select="head"/></strong></th>
    </tr>
   </thead>
   <tbody>
    <tr>
     <td>
      <xsl:apply-templates select="pvlist"/>
     </td>
    </tr>
   </tbody>
  </table>
 </xsl:template>
 
 <xsl:template match="pvlist">
    <table border="0">
       <thead>
        <tr>
         <th align="left">Property</th>
         <th align="left">Value</th>
        </tr>
       </thead>
       <tbody valign="top">
        <xsl:apply-templates select="pvpair"/>
       </tbody>
      </table>
 </xsl:template>
 
 <xsl:template match="pvpair">
  <tr>
   <td><xsl:call-template name="propref">
   <xsl:with-param name="ob">{</xsl:with-param>
   <xsl:with-param name="cb">}</xsl:with-param>
       </xsl:call-template></td>
   <td>
    <xsl:apply-templates/>
   </td>
  </tr>
 </xsl:template>

<xsl:template match="restrictCases">
  <table class="restricts" border="2">
   <thead>
    <tr>
     <th/>
     <th><strong>Base Particle</strong></th>
    </tr>
   </thead>
   <tbody>
    <tr>
     <td>
<strong>Der- ived Part- icle</strong>
     </td>
     <td>
      <table border="1">
       <thead>
        <tr>
         <th/>
         <th>elt</th>
         <th>any</th>
         <th>all</th>
         <th>choice</th>
         <th>sequence</th>
        </tr>
       </thead>
       <tbody><xsl:apply-templates select="restrict"/></tbody>
      </table>
     </td>
    </tr>
   </tbody>
  </table>
 </xsl:template>
 
 <xsl:template match="restrict">
  <tr>
   <th><xsl:value-of select="@case"/></th>
   <td>
    <xsl:call-template name="rcell">
     <xsl:with-param name="val" select="elt"/>
    </xsl:call-template>
   </td>
   <td>
    <xsl:call-template name="rcell">
     <xsl:with-param name="val" select="any"/>
    </xsl:call-template>
   </td>
   <td>
    <xsl:call-template name="rcell">
     <xsl:with-param name="val" select="all"/>
    </xsl:call-template>
   </td>
   <td>
    <xsl:call-template name="rcell">
     <xsl:with-param name="val" select="choice"/>
    </xsl:call-template>
   </td>
   <td>
    <xsl:call-template name="rcell">
     <xsl:with-param name="val" select="seq"/>
    </xsl:call-template>
   </td>
  </tr>
 </xsl:template>
 
 <xsl:template name="rcell">
  <xsl:param name="val"/>
  <xsl:choose>
   <xsl:when test="$val='Forbidden'">
    <xsl:text>Forbidden</xsl:text>
   </xsl:when>
   <xsl:otherwise><a href="#rcase-{$val}"><xsl:value-of select="$val"/></a></xsl:otherwise>
  </xsl:choose>  
 </xsl:template>
<!--* CMSMcQ:  see if I can work on olist here ...
    *-->
<xsl:template match="constraintnote//olist|propmap//olist">
 <table class="constraintlist">
  <xsl:apply-templates/>
 </table>
</xsl:template>

<xsl:template match="constraintnote//olist/item">
 <tr><td class="clnumber">
  <!--* N.B. The win32 and UN*X versions of XT go into an infinite loop
      * when I specify level='any', which looks like it would
      * number things correctly.  Damn.
  <xsl:number level="any" 
              count="constraintnote/p/olist" 
              from="constraintnote" 
              format="[1]"/>
      *-->
  <xsl:number level="multiple" count="constraintnote/p[olist]|olist[../self::*[olist[2]]]|item[../self::olist[item[2]]]" from="constraintnote" format="1"/>
  <xsl:text> </xsl:text>
 </td>
 <td>
  <xsl:apply-templates/>
 </td>
 </tr>
</xsl:template>

 <!-- in a hurry, hack by copy -->
 <xsl:template match="propmap//olist/item">
 <tr><td class="clnumber">
  <!--* N.B. The win32 and UN*X versions of XT go into an infinite loop
      * when I specify level='any', which looks like it would
      * number things correctly.  Damn.
  <xsl:number level="any" 
              count="constraintnote/p/olist" 
              from="constraintnote" 
              format="[1]"/>
      *-->
  <xsl:number level="multiple" count="propmap/p[olist]|olist[../self::*[olist[2]]]|item[../self::olist[item[2]]]" from="propmap" format="1"/>
  <xsl:text> </xsl:text>
 </td>
 <td>
  <xsl:apply-templates/>
 </td>
 </tr>
</xsl:template>

<xsl:template match="liststyle/constraintnote//olist">
 <ol class="ccol" style="list-style-type:none">
  <xsl:apply-templates/>
 </ol>
</xsl:template>

<xsl:template match="liststyle/constraintnote//olist/item">
 <li class="ccli">
  <!--* N.B. The win32 version of XT goes into an infinite loop
      * when I specify level='any', which should number things right.
  <xsl:number level="any" 
              count="constraintnote/p/olist" 
              from="constraintnote" 
              format="[1]"/>
      *-->
  <xsl:number level="multiple" count="constraintnote/p" from="constraintnote" format="[1]"/>
  <xsl:text>.</xsl:text>
  <xsl:number level="multiple" count="item" format="1"/>
  <xsl:text> </xsl:text>
  <xsl:apply-templates/>
 </li>
</xsl:template>

</xsl:stylesheet>
