<?xml version="1.0" encoding="utf-8"?>
<!-- HH 2004-10-19 -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:h="http://www.w3.org/1999/xhtml"
                exclude-result-prefixes="h"
                version="1.0">
  
  <xsl:output indent="yes"
	      doctype-public="-//W3C//DTD Specification V2.1//EN"
	      doctype-system="xmlspec.dtd"
	      />

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

  <xsl:template match="h:html">
    <spec w3c-doctype="wd" role="editors-copy">
      <header>
        <title><xsl:apply-templates select="h:head/h:title"/></title>
        <w3c-designation>WD</w3c-designation>
        <w3c-doctype></w3c-doctype>
        <pubdate>
          <day>@@@</day>
          <month>@@@</month>
          <year>@@@</year>
        </pubdate>
        <publoc>
	</publoc>
        <prevlocs>
	</prevlocs>
        <authlist>
          <author>
            <name>@@@</name>
            <affiliation>@@@</affiliation>
          </author>
        </authlist>
        <abstract>
	  <p>
	    @@@
	  </p>
        </abstract>
	<status>
	  <p>
	    @@@
	  </p>
	</status>
        <langusage>
          <language id="en-US">English</language>
        </langusage>
        <revisiondesc>
          <p>Last Modified: $Date: 2004/10/19 10:49:33 $</p>
        </revisiondesc>
      </header>
      <xsl:apply-templates select="h:body"/>
    </spec>
  </xsl:template>

  <xsl:template match="h:body">
    <body>
      <xsl:apply-templates select="h:div[@class='div1']"/>
    </body>
  </xsl:template>

  <xsl:template match="h:h2|h:h3">
    <head>
      <xsl:value-of select="."/>
    </head>
  </xsl:template>

  <xsl:template match="h:div[@class='div1']">
    <div1 id="{h:h2/h:a/@id}">
      <xsl:apply-templates/>
    </div1>
  </xsl:template>

  <xsl:template match="h:div[@class='div2']">
    <div2 id="{h:h3/h:a/@id}">
      <xsl:apply-templates/>
    </div2>
  </xsl:template>

  <xsl:template match="h:div[@class='div3']">
    <div3 id="{h:h3/h:a/@id}">
      <xsl:apply-templates/>
    </div3>
  </xsl:template>

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

  <xsl:template match="h:ul">
    <ulist><xsl:apply-templates/></ulist>
  </xsl:template>

  <!-- This will also catch the bibliography; will need to be fixed by
  hand -->
  <xsl:template match="h:dl">
    <glist><xsl:apply-templates/></glist>
  </xsl:template>

  <!-- The following need to be grouped by hand later; I could have
       used XSLT 2.0, but... -->
  <xsl:template match="h:dt">
    <gitem><label><xsl:apply-templates/></label></gitem>
  </xsl:template>
  <xsl:template match="h:dd">
    <gitem><def><p><xsl:apply-templates/></p></def></gitem>
  </xsl:template>

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

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

  <xsl:template match="h:pre">
    <example>
      <head>@@@</head>
      <eg xml:space="preserve">
	<xsl:apply-templates/>
      </eg>
    </example>
  </xsl:template>

  <xsl:template match="h:table">
    <table summary='{@summary}'>
      <caption>@@@</caption>
      <xsl:apply-templates/>
    </table>
  </xsl:template>

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

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

  <xsl:template match="h:th">
    <th>
      <xsl:value-of select='h:p'/>
    </th>
  </xsl:template>

  <xsl:template match="h:td">
    <td>
      <xsl:value-of select='h:p'/>
    </td>
  </xsl:template>

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

</xsl:stylesheet>

