<?xml-stylesheet href="http://www.w3.org/StyleSheets/base.css" type="text/css"?><?xml-stylesheet href="http://www.w3.org/2002/02/style-xsl.css" type="text/css"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml">

<!-- Output method XML -->
<xsl:output method="xml" 
  indent="yes"
  omit-xml-declaration="no" 
  encoding="utf-8" 
  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"  />

<!-- useful for tools based on the XSLT servlet -->
  <xsl:param name="xmlfile"/>
  <xsl:variable name="doc_uri">
    <xsl:choose>
      <xsl:when test="starts-with($xmlfile,'http://cgi.w3.org/cgi-bin/tidy-if?docAddr=')">
        <xsl:value-of select="substring-after($xmlfile,'http://cgi.w3.org/cgi-bin/tidy-if?docAddr=')"/>
      </xsl:when>
      <xsl:when test="starts-with($xmlfile,'http://cgi.w3.org/cgi-bin/tidy?docAddr=')">
        <xsl:value-of select="substring-after($xmlfile,'http://cgi.w3.org/cgi-bin/tidy?docAddr=')"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$xmlfile"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

 
<!-- Documenting the XSLT : fill the @@@-->
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link rel="stylesheet" href="http://www.w3.org/StyleSheets/base"/>
    <title>Glossary creator</title>
  </head>
  <body>
    <div class='head'><a href="/"><img src="/Icons/w3c_home" alt="W3C"/></a></div>
    <h1>Glossary creator</h1>

    <p>This XSLT style sheet extracts the definitions from an HTML page, where terms are marked up with &lt;dfn> and their definitions are assumed to be the text contained in the parent element.</p>

    <!-- Useful when used with the XSLT-online servlet -->
    <!-- Make sure to set the @@@ value to the URI of the published XSLT -->
    <form action="http://www.w3.org/2002/08/xslt4html" method="get">
      <div>
        <input type="hidden" name="xslfile" value="http://www.w3.org/2004/07/def-to-glossary.xsl" />
        <p><label>URI of the HTML page: <input type="text" name="xmlfile" value="http://www.w3.org/" /></label></p>
        <p><input type="submit" value="Process" /><input type="reset" /></p>
      </div>
    </form>


    <p class="copyright">Copyright &#169; 1994-2004 <a href="http://www.w3.org/">World Wide Web Consortium</a>, (<a
href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of
Technology">M.I.T.</acronym></a>, <a
href="http://www.ercim.org/"><acronym
title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
    Reserved. http://www.w3.org/Consortium/Legal/. W3C <a href="http://www.w3.org/Consortium/Legal/copyright-software">software licensing</a> rules apply.</p>
    <address><a href="http://www.w3.org/People/Dom/">Dominique Haza&#235;l-Massieux</a> - $Id: def-to-glossary.xsl,v 1.1 2004/07/26 14:06:55 dom Exp $</address>
    </body>
</html>

<xsl:template match="/">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link rel="stylesheet" href="http://www.w3.org/StyleSheets/base"/>
    <title>Extracted glossary</title>
  </head>
  <body>
    <div class='head'><a href="/"><img src="/Icons/w3c_home" alt="W3C"/></a></div>
    <h1>Extracted glossary</h1>
    <dl class='glossary'>
      <xsl:for-each select="//html:dfn">
        <dt class='label'><xsl:value-of select="."/></dt>
        <dd><xsl:value-of select="parent::html:*"/></dd>
      </xsl:for-each>
    </dl>
  </body>
  </html>
</xsl:template>

  <!-- default: Identity Transformation -->
  <xsl:template match="*|@*|comment()|text()">
    <xsl:copy>
      <xsl:apply-templates select="*|@*|comment()|text()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>
