<?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" exclude-result-prefixes="uri http" xmlns:http="http://www.w3.org/2001/11/http-head.xsl" xmlns:uri="http://www.w3.org/2000/07/uri43/uri.xsl?template="
>

<xsl:import href="../../2001/11/http-head.xsl"/>
<xsl:import href="http://www.w3.org/2000/07/uri43/uri.xsl" />

<!-- 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>

 
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link rel="stylesheet" href="http://www.w3.org/StyleSheets/base"/>
    <title>Links annotater</title>
  </head>
  <body>
    <div class='head'><a href="/"><img src="/Icons/w3c_home" alt="W3C"/></a></div>
    <h1>Links annotater</h1>

    <!-- Useful when used with the XSLT-online servlet -->
    <!-- Make sure to set the @@@ value to the URI of the published XSLT -->
    <form action="annotate" method="get">
      <div>
        <p><label>URI of the HTML page: <input type="text" name="xmlfile" value="http://www.w3.org/" /></label></p>
        <p><label>Proxy HTTP Auth: <input type="checkbox" name="recurse_auth" /> (Team-only)</label></p>
        <p><input type="submit" value="Process" /><input type="reset" /></p>
      </div>
    </form>


    <p class="copyright">Copyright &#169; 1994-2005 <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: annotate-last-modification.xsl,v 1.20 2007/07/12 07:59:55 dom Exp $</address>
    </body>
</html>

<xsl:template match="html:head">
  <xsl:copy>
    <base href="{$doc_uri}" />
    <xsl:apply-templates select="*|@*|comment()|text()"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="html:title">
    <xsl:copy>
      <xsl:apply-templates select="*|@*|comment()|text()"/>
    </xsl:copy>
    <link rel="stylesheet" href="/2005/02/links-annotation" />
</xsl:template>

  <xsl:template match="html:a[@href and (starts-with(@href,'http:') or not(contains(@href,':')))]">
    <xsl:variable name="absUri">
      <xsl:call-template name="uri:expand">
        <xsl:with-param name="base" select="$doc_uri"/>
        <xsl:with-param name="there" select="@href"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="status">
      <xsl:call-template name="http:get-status-code">
        <xsl:with-param name="doc_uri" select="$absUri"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:copy>
      <xsl:apply-templates select="*|@*|comment()|text()"/>
    </xsl:copy>
    <xsl:choose>
      <xsl:when test="$status='200'"> 
        <xsl:variable name="lastMod">
          <xsl:call-template name="http:get-header">
            <xsl:with-param name="header_name" select="'Last-Modified'"/>
            <xsl:with-param name="doc_uri" select="$absUri"/>
          </xsl:call-template>
        </xsl:variable>
        <xsl:variable name="year" select="substring(normalize-space($lastMod),13,4)"/>
        <span>
          <xsl:attribute name="class">
            <xsl:text>annotation </xsl:text>
            <xsl:choose>
              <xsl:when test="contains($year,'199')">
                <xsl:text>y1990</xsl:text>
              </xsl:when>
              <xsl:otherwise>
                <xsl:text>y</xsl:text><xsl:value-of select="$year"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:attribute>
          <xsl:value-of select="substring(normalize-space($lastMod),5,12)"/>
        </span>
      </xsl:when>
      <xsl:when test="$status='404'">
        <span class='annotation'>broken link</span>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

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

  
</xsl:stylesheet>