<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- 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">
<!-- 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="xspecxmpls.xsl"/>
<xsl:import href="xmlspec.xsl"/>

<!-- Override - - always empty and single in xmlschema-1,
     section numbers after in ()s -->
<!-- Check print for underline, else bold -->
 <xsl:template match="specref">
		<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}
                                       p.element-syntax { border: solid thin }
</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="example"]|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><pre>
                <xsl:if test='@role="error"'>
                  <xsl:attribute name='style'>color: red</xsl:attribute>
                </xsl:if>
                    <xsl:apply-templates/>
                  </pre>
        </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>
               <p><b>
                 <xsl:choose>
                      <xsl:when test='@type="cos"'>
                          <xsl:text>Constraint on Schemas:  </xsl:text>
                      </xsl:when>
                      <xsl:when test='@type="svc"'>
                          <xsl:text>Schema-validity Constraint:  </xsl:text>
                      </xsl:when>
                      <xsl:when test='@type="sic"'>
                          <xsl:text>Schema Information Set Contribution:  </xsl:text>
                      </xsl:when>
                      <xsl:otherwise>Constraint:  </xsl:otherwise>
                 </xsl:choose>
               <xsl:value-of select='head'/>
               </b><br/>
               <xsl:apply-templates/>
               </p>
             </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"/>

</xsl:stylesheet>
