changeset 46:c7b8bbeb877a

~ many things
author Alexandre Bertails <bertails@w3.org>
date Wed, 28 Sep 2011 10:30:22 -0400
parents 2cd3a150d581
children f0491f915432
files .hgignore files.txt files/.keep project/Build.scala src/main/resources/WWW/2000/07/uri43/uri.xsl src/main/resources/WWW/2001/07/pubrules-copyright.xml src/main/resources/WWW/2001/08/date-util.xslt src/main/resources/WWW/2001/10/str-util.xsl src/main/resources/WWW/2001/11/http-head.xsl src/main/resources/WWW/2001/11/is-valid.xsl src/main/resources/WWW/2005/09/checker/pubrules-tests.xsl src/main/resources/WWW/2005/09/checker/utils.xsl src/main/resources/WWW/2005/09/checker/ws-normalize.xsl src/main/scala/Main.scala src/main/scala/URLResolver.scala
diffstat 14 files changed, 3257 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Mon Aug 15 16:45:38 2011 -0400
+++ b/.hgignore	Wed Sep 28 10:30:22 2011 -0400
@@ -12,4 +12,5 @@
 *.log
 *\#
 src/main/scala.egp
-src/test/scala.egp
\ No newline at end of file
+src/test/scala.egp
+files/*
\ No newline at end of file
--- a/files.txt	Mon Aug 15 16:45:38 2011 -0400
+++ b/files.txt	Wed Sep 28 10:30:22 2011 -0400
@@ -1,8 +1,5 @@
 WWW/2001/10/trdoc2rdf.xslt
 WWW/2001/10/trdoc-data.xsl
-#WWW/2000/04/mem-news/public-groups.rdf
-#WWW/2002/01/tr-automation/tr.rdf
-#WWW/2002/01/tr-automation/known-tr-editors.rdf
 WWW/2001/07/pubrules-copyright.xml
 
 WWW/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-frameset.dtd
@@ -15,3 +12,12 @@
 WWW/2005/07/13-pubrules.xsl
 WWW/2005/07/13-pubrules-src.html
 WWW/2005/09/checker/frame.xsl
+
+WWW/2005/09/checker/pubrules-tests.xsl
+WWW/2001/10/str-util.xsl                                                   
+WWW/2001/11/is-valid.xsl                                                   
+WWW/2001/11/http-head.xsl                                                  
+WWW/2000/07/uri43/uri.xsl                                                  
+WWW/2005/09/checker/ws-normalize.xsl                                       
+WWW/2005/09/checker/utils.xsl                                              
+WWW/2001/08/date-util.xslt                                                 
--- a/project/Build.scala	Mon Aug 15 16:45:38 2011 -0400
+++ b/project/Build.scala	Wed Sep 28 10:30:22 2011 -0400
@@ -3,24 +3,35 @@
 import java.net.URL
 
 object Dependencies {
+
+  /** 
+   * - download the zip under the given URL
+   * - unzip in /tmp
+   * - copy the jarName in the local repository
+   * - returns the local URL
+   */
+  def fromZip(zipURL:String, jarName:String):String = {
+    val local = new File("files/"+jarName)
+    // if not found, we have to download it
+    if (! local.exists) {
+      val url = new URL(zipURL)
+      val zip = new File("/tmp/%s.zip" format jarName)
+      url.#>(zip).!
+      Process("unzip -o /tmp/%s.zip -d /tmp" format jarName).!
+      Process("cp /tmp/%s -d %s" format (jarName, local.getAbsolutePath)).!
+    }
+    "file://" + local.getAbsolutePath
+  }
+
   val scalatest = "org.scalatest" % "scalatest_2.9.0" % "1.6.1" % "test"
   val antiXML = "com.codecommit" %% "anti-xml" % "0.3-SNAPSHOT"
   val jodatime = "joda-time" % "joda-time" % "1.6.2"
   val dispatch = "net.databinder" %% "dispatch-http" % "0.8.4"
-  val saxon = "saxon" % "saxon" % "saxonhe9-3-0-5j" from {
-    val local = new File("/tmp/saxon9he.jar")
-    if (! local.exists) {
-      val url = new URL("http://downloads.sourceforge.net/project/saxon/Saxon-HE/9.3/saxonhe9-3-0-5j.zip")
-      val zip = new java.io.File("/tmp/tmp.zip")
-      url.#>(zip).!
-      Process("unzip -o /tmp/tmp.zip -d /tmp").!  
-    }
-    "file://" + local.getAbsolutePath
-  }
-//  val time = "org.scala-tools.time" %% "time" % "0.5-SNAPSHOT"
-   val unfiltered_filter = "net.databinder" %% "unfiltered-filter" % "0.4.1"
-   val unfiltered_jetty = "net.databinder" %% "unfiltered-jetty" % "0.4.1"
-   val avsl = "org.clapper" %% "avsl" % "0.3.1"
+  val saxon = "saxon" % "saxon" % "saxonhe9-3-0-5j" from fromZip("http://downloads.sourceforge.net/project/saxon/Saxon-HE/9.3/saxonhe9-3-0-5j.zip", "saxon9he.jar")
+  val unfiltered_filter = "net.databinder" %% "unfiltered-filter" % "0.4.1"
+  val unfiltered_jetty = "net.databinder" %% "unfiltered-jetty" % "0.4.1"
+  val avsl = "org.clapper" %% "avsl" % "0.3.1"
+  val jTidy = "jtidy" % "jtidy" % "r938" from fromZip("http://sourceforge.net/projects/jtidy/files/JTidy/r938/jtidy-r938.zip", "jtidy-r938.jar")
 }
 
 object BuildSettings {
@@ -48,16 +59,14 @@
     Seq(
       resolvers += ScalaToolsReleases,
       resolvers += ScalaToolsSnapshots,
-//      resolvers += "java m2" at "http://download.java.net/maven/2",
-//      resolvers += "Scala Tools Nexus" at "http://nexus.scala-tools.org/content/repositories/snapshots/",
       libraryDependencies += scalatest,
       libraryDependencies += antiXML,
       libraryDependencies += jodatime,
       libraryDependencies += dispatch,
       libraryDependencies += saxon,
       libraryDependencies += unfiltered_filter,
-      libraryDependencies += unfiltered_jetty
-//      libraryDependencies += avsl
+      libraryDependencies += unfiltered_jetty,
+      libraryDependencies += jTidy
     )
 
   lazy val pubrules = Project(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/WWW/2000/07/uri43/uri.xsl	Wed Sep 28 10:30:22 2011 -0400
@@ -0,0 +1,328 @@
+<!-- -*- mode: indented-text;-*- -->
+<xsl:transform
+    xmlns:xsl  ="http://www.w3.org/1999/XSL/Transform" version="1.0"
+    xmlns:uri  ="http://www.w3.org/2000/07/uri43/uri.xsl?template="
+    xmlns:html ="http://www.w3.org/1999/xhtml"
+    exclude-result-prefixes="uri html"
+	>
+
+<div xmlns="http://www.w3.org/1999/xhtml">
+
+<h2>Share and Enjoy</h2>
+
+<p>$Id: uri.xsl,v 1.12 2004/11/05 10:35:03 dom Exp $</p>
+
+<p>Copyright (c) 2000 W3C (MIT, INRIA, Keio), released under the <a
+href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">
+W3C Open Source License</a> of August 14 1998.  </p>
+
+<h2>Reference</h2>
+
+<p><cite><a href="http://www.ietf.org/rfc/rfc2396.txt">Uniform
+    Resource Identifiers (URI): Generic Syntax</a></cite> (RFC 2396)
+    T. Berners-Lee, R. Fielding, L. Masinter August 1998 </p>
+
+</div>
+
+<xsl:param name="Debug" select="0"/>
+
+<xsl:variable name="uri:lowalpha"
+	      select='"abcdefghijklmnopqrstuvwxyz"'/>
+<xsl:variable name="uri:upalpha"
+	      select='"ABCDEFGHIJKLMNOPQRSTUVWXYZ"'/>
+<xsl:variable name="uri:digit"
+	      select='"01234567890"'/>
+<xsl:variable name="uri:alpha"
+	      select='concat($uri:lowalpha, $uri:upalpha)'/>
+
+<xsl:template name="uri:expand">
+  <!-- 5.2. Resolving Relative References to Absolute Form -->
+  <xsl:param name="base"/> <!-- an absolute URI -->
+  <xsl:param name="there"/> <!-- a URI reference -->
+
+  <!-- @@assert that $there contains only URI characters -->
+  <!-- @@implement the unicode->ascii thingy from HTML 4.0 -->
+
+  <xsl:variable name="fragment" select='substring-after($there, "#")'/>
+		<!-- hmm... I'd like to split after the *last* #,
+		     but substring-after splits after the first occurence.
+		     Anyway... more than one # is illegal -->
+
+  <xsl:variable name="hashFragment">
+    <xsl:choose>
+      <xsl:when test="string-length($fragment) > 0">
+        <xsl:value-of select='concat("#", $fragment)'/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select='""'/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:variable name="rest"
+		select='substring($there, 1,
+			          string-length($there)
+				  - string-length($hashFragment))'/>
+
+  <xsl:if test="$Debug"><xsl:message>
+    there: [<xsl:value-of select="$there"/>]
+    fragment: [<xsl:value-of select="$fragment"/>]
+    hashFragment: [<xsl:value-of select="$hashFragment"/>]
+    rest: [<xsl:value-of select="$rest"/>]
+  </xsl:message></xsl:if>
+
+  <xsl:choose>
+    <!-- step 2) -->
+    <xsl:when test="string-length($rest) = 0">
+      <xsl:if test="0">
+      <xsl:message>ur:expand called with reference to self-same document.
+			     should this be prohibited? i.e.
+			     should the caller handle references
+			     to the self-same document?</xsl:message>
+      </xsl:if>
+      <xsl:value-of select="concat($base, $hashFragment)"/>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:variable name="scheme">
+        <xsl:call-template name="uri:split-scheme">
+	  <xsl:with-param name="ref" select="$rest"/>
+	</xsl:call-template>
+      </xsl:variable>
+
+      <xsl:choose>
+        <xsl:when test='string-length($scheme) > 0'>
+	  <!-- step 3) ref is absolute. we're done -->
+	  <xsl:value-of select="$there"/>
+	</xsl:when>
+        <xsl:when test="string-length($base) = 0">
+          <!-- if base is not an absoute uri, no point to continue processing -->
+          <xsl:message>base uri empty, defaulting to return there</xsl:message>
+          <xsl:value-of select="$there"/>
+        </xsl:when>
+        <xsl:otherwise>
+	  <xsl:variable name="rest2"
+			select='substring($rest, string-length($scheme) + 1)'/>
+
+	  <xsl:variable name="baseScheme">
+	    <xsl:call-template name="uri:split-scheme">
+	    <xsl:with-param name="ref" select="$base"/>
+	    </xsl:call-template>
+	  </xsl:variable>
+
+	  <xsl:choose>
+	    <xsl:when test='starts-with($rest2, "//")'>
+	      <!-- step 4) network-path; we're done -->
+
+	      <xsl:value-of select='concat($baseScheme, ":",
+					   $rest2, $hashFragment)'/>
+            </xsl:when>
+
+	    <xsl:otherwise>
+
+	      <xsl:variable name="baseRest"
+			    select='substring($base,
+				 string-length($baseScheme) + 2)'/>
+
+	      <xsl:variable name="baseAuthority">
+		<xsl:call-template name="uri:split-authority">
+		  <xsl:with-param name="ref" select="$baseRest"/>
+		</xsl:call-template>
+	      </xsl:variable>
+
+	      <xsl:choose>
+	        <xsl:when test='starts-with($rest2, "/")'>
+		  <!-- step 5) absolute-path; we're done -->
+
+		  <xsl:value-of select='concat($baseScheme, ":",
+					       $baseAuthority,
+					       $rest2, $hashFragment)'/>
+		</xsl:when>
+
+		<xsl:otherwise>
+		  <!-- step 6) relative-path -->
+		  <!-- @@ this part of the implementation is *NOT*
+		       per the spec, because I want combine(wrt(x,y))=y
+		       even in the case of y = foo/../bar
+		       -->
+
+		  <xsl:variable name="baseRest2"
+			    select='substring($baseRest,
+				 string-length($baseAuthority) + 1)'/>
+
+		  <xsl:variable name="baseParent">
+		    <xsl:call-template name="uri:path-parent">
+		      <xsl:with-param name="path" select="$baseRest2"/>
+		    </xsl:call-template>
+		  </xsl:variable>
+
+		  <xsl:variable name="path">
+		    <xsl:call-template name="uri:follow-path">
+		      <xsl:with-param name="start" select="$baseParent"/>
+		      <xsl:with-param name="path" select="$rest2"/>
+		    </xsl:call-template>
+		  </xsl:variable>
+
+		  <xsl:if test="$Debug"><xsl:message>
+		    step 6 rel
+		    rest2: [<xsl:value-of select="$rest2"/>]
+		    baseRest2: [<xsl:value-of select="$baseRest2"/>]
+		    baseParent: [<xsl:value-of select="$baseParent"/>]
+		    path: [<xsl:value-of select="$path"/>]
+		  </xsl:message></xsl:if>
+
+		  <xsl:value-of select='concat($baseScheme, ":",
+					       $baseAuthority,
+					       $path,
+					       $hashFragment)'/>
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:otherwise>
+	  </xsl:choose>
+
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="uri:split-scheme">
+  <!-- from a URI reference -->
+  <xsl:param name="ref"/>
+
+  <xsl:variable name="scheme_"
+		    select='substring-before($ref, ":")'/>
+  <xsl:choose>
+    <!-- test whether $scheme_ is a legal scheme name,
+	 i.e. whether it starts with an alpha
+	 and contains only alpha, digit, +, -, .
+	 -->
+    <xsl:when
+      test='string-length($scheme_) > 0
+            and contains($uri:alpha, substring($scheme_, 1, 1))
+	    and string-length(translate(substring($scheme_, 2),
+			                concat($uri:alpha, $uri:digit,
+					       "+-."),
+				        "")) = 0'>
+	  <xsl:value-of select="$scheme_"/>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:value-of select='""'/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="uri:split-authority">
+  <!-- from a URI reference that has had the fragment identifier
+       and scheme removed -->
+       <!-- cf 3.2. Authority Component -->
+
+  <xsl:param name="ref"/>
+
+  <xsl:choose>
+    <xsl:when test='starts-with($ref, "//")'>
+      <xsl:variable name="auth1" select='substring($ref, 3)'/>
+      <xsl:variable name="auth2">
+        <xsl:choose>
+          <xsl:when test='contains($auth1, "?")'>
+	    <xsl:value-of select='substring-before($auth1, "?")'/>
+	  </xsl:when>
+	  <xsl:otherwise><xsl:value-of select="$auth1"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="auth3">
+        <xsl:choose>
+          <xsl:when test='contains($auth2, "/")'>
+	    <xsl:value-of select='substring-before($auth1, "/")'/>
+	  </xsl:when>
+	  <xsl:otherwise><xsl:value-of select="$auth2"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:variable>
+
+      <xsl:value-of select='concat("//", $auth3)'/>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:value-of select='""'/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="uri:follow-path">
+  <xsl:param name="start"/> <!-- doesn't end with / ; may be empty -->
+  <xsl:param name="path"/> <!-- doesn't start with / -->
+
+  <xsl:if test="$Debug"><xsl:message>
+    follow-path
+    start: [<xsl:value-of select="$start"/>]
+    path: [<xsl:value-of select="$path"/>]
+  </xsl:message></xsl:if>
+
+  <xsl:choose>
+    <xsl:when test='starts-with($path, "./")'>
+      <xsl:call-template name="uri:follow-path">
+        <xsl:with-param name="start" select="$start"/>
+	<xsl:with-param name="path" select='substring($path, 3)'/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:when test='starts-with($path, "../")'>
+      <xsl:call-template name="uri:follow-path">
+        <xsl:with-param name="start">
+	  <xsl:call-template name="uri:path-parent">
+	    <xsl:with-param name="path" select="$start"/>
+	  </xsl:call-template>
+	</xsl:with-param>
+	<xsl:with-param name="path" select='substring($path, 4)'/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:value-of select='concat($start, "/", $path)'/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="uri:path-parent">
+  <xsl:param name="path"/>
+
+  <xsl:if test="$Debug"><xsl:message>
+    path parent
+    path: [<xsl:value-of select="$path"/>]
+  </xsl:message></xsl:if>
+
+  <xsl:choose>
+	      <!-- foo/bar/    => foo/bar    , return -->
+    <xsl:when test='substring($path, string-length($path)) = "/"'>
+      <xsl:value-of select='substring($path, 1, string-length($path)-1)'/>
+    </xsl:when>
+
+	      <!-- foo/bar/baz => foo/bar/ba , recur -->
+	      <!-- foo/bar/ba  => foo/bar/b  , recur -->
+	      <!-- foo/bar/b   => foo/bar/   , recur -->
+    <xsl:when test='contains($path, "/")'>
+      <xsl:call-template name="uri:path-parent">
+        <xsl:with-param name="path"
+		   select='substring($path, 1, string-length($path)-1)'/>
+      </xsl:call-template>
+    </xsl:when>
+
+	      <!-- '' => '' -->
+	      <!-- foo => '' -->
+    <xsl:otherwise>
+      <xsl:value-of select='""'/>
+    </xsl:otherwise>
+
+  </xsl:choose>
+
+</xsl:template>
+
+
+</xsl:transform>
+
--- a/src/main/resources/WWW/2001/07/pubrules-copyright.xml	Mon Aug 15 16:45:38 2011 -0400
+++ b/src/main/resources/WWW/2001/07/pubrules-copyright.xml	Wed Sep 28 10:30:22 2011 -0400
@@ -164,7 +164,7 @@
 <dd><a href="http://www.w3.org/2002/ws/ra/">Public home page</a></dd>
 <dt><a href="http://www.w3.org/2001/tag/">Technical Architecture Group</a></dt>
 <dd><a href="http://www.w3.org/2001/tag/">Public Home page</a></dd>
-<dt><a href="http://www.w3.org/2009/dap/">Device APIs and Policy Working Group</a></dt>
+<dt><a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a></dt>
 <dd><a href="http://www.w3.org/2009/dap/">Public Home page</a></dd>
 <dt><a href="http://www.w3.org/2001/sw/rdb2rdf/">RDB2RDF Working Group</a></dt>
 <dd><a href="http://www.w3.org/2011/sw/rdb2rdf/">Public Home page</a></dd>
@@ -198,6 +198,12 @@
 <dd><a href="http://www.w3.org/XML/XPPL/">Public Home page</a></dd>
 <dt><a href="http://www.w3.org/2011/04/webrtc/">Web Real-Time Communications Working Group</a></dt>
 <dd><a href="http://www.w3.org/2011/04/webrtc/">Public Home page</a></dd>
+<dt><a href="http://www.w3.org/Security/IG/">Web Security Interest Group</a></dt>
+<dd><a href="http://www.w3.org/Security/IG/">Public Home page</a></dd>
+<dt><a href="http://www.w3.org/2011/webappsec/">Web Application Security Working Group</a></dt>
+<dd><a href="http://www.w3.org/2011/webappsec/">Public Home page</a></dd>
+<dt><a href="http://www.w3.org/2011/tracking-protection/">Tracking Protection Working Group</a></dt>
+<dd><a href="http://www.w3.org/2011/tracking-protection/">Public Home page</a></dd>
 </dl>
 </div>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/WWW/2001/08/date-util.xslt	Wed Sep 28 10:30:22 2011 -0400
@@ -0,0 +1,210 @@
+<?xml version="1.0"?>
+<!--
+$Id: date-util.xslt,v 1.43 2011/06/28 15:03:58 dom Exp $
+
+This XSLT stylesheet offers 3 functions:
+- makeDateFriendly take a date in format YYYYMMDD (param: date) and transforms it in the format dd Month YYYY 
+- makeMonthFriendly takes the number of a month (param: month) and gives its literal from
+- makeDateNumeric takes a date in format dd Month YYYY (param: friendlyDate) and givtes it literal form (YYYYMMDD)
+-->
+<?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 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://www.w3.org/2001/08/date-util.xslt" version="1.0" xmlns:str="http://www.w3.org/2001/10/str-util.xsl" xmlns:foo="urn:foo">
+
+  <xsl:import href="../10/str-util.xsl"/>
+<div xmlns="http://www.w3.org/1999/xhtml">
+           <h1>
+    <a href="http://www.w3.org/">
+      <img src="http://www.w3.org/Icons/w3c_home" alt="W3C" />
+    </a>
+
+    XSLT Templates to manipulate dates</h1>
+    <h2>Status</h2>
+    <p>The templates in this stylesheet are used in several other ones. Please don't modify it without letting me know and don't break the current exposed API.</p>
+    <h2>Templates</h2>
+
+    <dl>
+        <dt>date:makeDateFriendly</dt>
+        <dd>Parameter: <code>date</code> being a date in YYYYMMDD format. Transforms it into an English litteral date (e.g. 20001005 -> 5 October 2001)</dd>
+        <dt>date:makeMonthFriendly</dt>
+        <dd>Parameter: 0&lt;<code>month</code>&lt;13. Transforms it into an English litteral month (e.g. 10->October)</dd>
+        <dt>date:makeDateNumeric</dt>
+        <dd>Parameter: <code>friendlyDate</code> (an English litteral date). Transforms it into a numeric date, format YYYYMMDD. If a non-null<code>format-iso</code> parameter is passed, it will be formated ala YYYY-MM-DD</dd>
+        <dt>date:makeAbbrDateNumeric</dt>
+        <dd>Parameter: <code>abbrDate</code>. Transforms a date ala "Sep 12 2002" into a date formatted ala YYYY-MM-DD</dd>
+	<dt>date:extract-date</dt>
+        <dd>Parameter: <code>year</code>, <code>string</code> (optional, default value to the value of the current node). Extracts a date from <code>string</code> within the given year (works for date formated ala 16 April 2002) and returns it as YYYYMMDD</dd>
+        <dt>date:extract-date-between</dt>
+        <dd>Parameter: <code>low_bound</code>, <code>high_bound</code>. Extract any date from the current node which is between <code>low_bound</code> and <code>high_bound</code></dd>
+    </dl>
+<hr/>
+<address>$Id: date-util.xslt,v 1.43 2011/06/28 15:03:58 dom Exp $<br/><a href="../../People/Dom/">Dominique Hazael-Massieux</a></address>
+<hr/>
+</div>
+<data  xmlns="urn:foo">
+<months xmlns="" xml:lang="en-US">
+ <month num="1" abbr="Jan">January</month>
+ <month num="2" abbr="Feb">February</month>
+ <month num="3" abbr="Mar">March</month>
+ <month num="4" abbr="Apr">April</month>
+ <month num="5" abbr="May">May</month>
+ <month num="6" abbr="Jun">June</month>
+ <month num="7" abbr="Jul">July</month>
+ <month num="8" abbr="Aug">August</month>
+ <month num="9" abbr="Sep">September</month>
+ <month num="10" abbr="Oct">October</month>
+ <month num="11" abbr="Nov">November</month>
+ <month num="12" abbr="Dec">December</month>
+</months>
+</data>
+
+<xsl:variable name="date:month_list" select="document('')/xsl:stylesheet/foo:data/months"/>
+
+<xsl:template name="date:makeDateFriendly">
+        <xsl:param name="date"/>
+        <xsl:variable name="year" select="substring($date,1,4)"/>
+        <xsl:value-of select="concat(number(substring($date,7,2)),' ')"/><xsl:call-template name="date:makeMonthFriendly"><xsl:with-param name="month" select="substring($date,5,2)"/></xsl:call-template><xsl:value-of select="concat(' ',$year)"/>
+</xsl:template>
+
+<xsl:template name="date:makeMonthFriendly">
+        <xsl:param name="month"/>
+        <xsl:value-of select="$date:month_list/month[@num=number($month)]"/>
+</xsl:template>
+
+<xsl:template name="date:makeDateNumeric">
+        <xsl:param name="friendlyDate"/>
+        <xsl:param name="format-iso"/>
+        <xsl:variable name="separator">
+          <xsl:if test="$format-iso">
+            <xsl:text>-</xsl:text>
+          </xsl:if>
+        </xsl:variable>
+        <xsl:variable name="friendlyDate2" select="normalize-space($friendlyDate)"/>
+        <xsl:value-of select="concat(
+                              substring-after(substring-after($friendlyDate2,' '),' '),
+                              $separator,
+                              format-number($date:month_list/month[.=substring-before(substring-after($friendlyDate2,' '),' ')]/@num,'00'),
+                              $separator,
+                              format-number(number(translate(substring-before($friendlyDate2,' '),'dhrst','')),'00')
+                              )"/>
+</xsl:template>
+
+<!-- June 8 2011 -->
+<xsl:template name="date:makeAbbrDateNumeric">
+  <xsl:param name="abbrDate"/>
+  <xsl:value-of select="concat(
+                        substring-after(substring-after($abbrDate,' '),' '),'-',
+                        format-number($date:month_list/month[@abbr=substring-before($abbrDate,' ')]/@num,'00'),'-',
+                        format-number(number(substring-before(substring-after($abbrDate,' '),' ')),'00')
+                        )"/>
+</xsl:template>
+
+<!-- 8 Jun 2011 -->
+<xsl:template name="date:makeAbbrDateNumeric2">
+  <xsl:param name="abbrDate"/>
+  <xsl:value-of select="concat(
+                        substring-after(substring-after($abbrDate,' '),' '),'-',
+                        format-number($date:month_list/month[@abbr=substring-before(substring-after($abbrDate,' '),' ')]/@num,'00'),'-',
+                        format-number(number(substring-before($abbrDate,' ')),'00')
+                        )"/>
+</xsl:template>
+
+
+  <xsl:template name="date:extract-date">
+    <xsl:param name="string" select="normalize-space(.)"/>
+    <xsl:param name="year"/>
+    <xsl:if test="contains($string,concat(' ',$year))">
+      <!-- Cut what's before the word before the year (supposingly the month) -->
+      <xsl:variable name="before-month">
+        <xsl:call-template name="str:keep-before-last">
+          <xsl:with-param name="string" select="substring-before($string,concat(' ',$year))"/>
+          <xsl:with-param name="delimiter" select="' '"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <!-- The month is what's between the year and the before-month strings -->
+      <xsl:variable name="month" select="normalize-space(substring-after(substring-before($string,$year),concat($before-month,' ')))"/> 
+
+      <!-- The day is the last word of the before-month string -->
+      <xsl:variable name="day">
+        <xsl:variable name="before-day">          
+          <xsl:call-template name="str:keep-before-last">
+            <xsl:with-param name="string" select="$before-month"/>
+            <xsl:with-param name="delimiter" select="' '"/>
+          </xsl:call-template>
+        </xsl:variable>
+
+        <!-- And the complete date is the concatenation of the day, month and year -->
+        <xsl:value-of select="normalize-space(substring-after(substring-before($string,concat($month,' ',$year)),concat($before-day,' ')))"/> 
+      </xsl:variable>
+
+      <!-- We make it numeric so that we can manipulate it more easily -->
+      <xsl:variable name="date">
+        <xsl:call-template name="date:makeDateNumeric">
+          <xsl:with-param name="friendlyDate" select="concat($day,' ',$month,' ',$year)"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <!-- Is that a number ? If yes, we have probably found what we were looking for -->
+      <xsl:if test="number($date)">
+        <xsl:value-of select="concat($date,' ')"/>
+      </xsl:if>
+
+      <!-- and we extract the date in the remaining of the string -->
+      <xsl:if test="contains(substring-after($string,$year),$year)">
+        <xsl:call-template name="date:extract-date">
+          <xsl:with-param name="year" select="$year"/>
+          <xsl:with-param name="string" select="substring-after($string,$year)"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="date:extract-date-between">
+    <xsl:param name="low_bound"/>
+    <xsl:param name="high_bound"/>
+
+    <xsl:variable name="year1" select="substring($low_bound,1,4)"/>
+    <xsl:variable name="year2" select="substring($high_bound,1,4)"/>
+    <xsl:if test="$year1 &lt;= $year2 and normalize-space($year1)">
+      <xsl:variable name="date">
+        <xsl:call-template name="date:extract-date">
+          <xsl:with-param name="year" select="$year1"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:call-template name="date:test-bound">
+        <xsl:with-param name="string" select="$date"/>
+        <xsl:with-param name="low_bound" select="$low_bound"/>
+        <xsl:with-param name="high_bound" select="$high_bound"/>
+      </xsl:call-template>
+
+      <xsl:if test="$year1 &lt; $year2">
+        <xsl:call-template name="date:extract-date-between">
+          <xsl:with-param name="low_bound" select="concat($year1+1,'0101')"/>
+          <xsl:with-param name="high_bound" select="$high_bound"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Not for external use, API free -->
+  <xsl:template name="date:test-bound">
+    <xsl:param name="string"/>
+    <xsl:param name="low_bound"/>
+    <xsl:param name="high_bound"/>
+    <xsl:if test="substring-before($string,' ') &lt; $high_bound and substring-before($string,' ') &gt; $low_bound">
+      <xsl:value-of select="concat(substring-before($string,' '),' ')"/>
+    </xsl:if>
+    <xsl:if test="normalize-space(substring-after($string,' '))">
+      <xsl:call-template name="date:test-bound">
+        <xsl:with-param name="string" select="substring-after($string,' ')"/>
+        <xsl:with-param name="low_bound" select="$low_bound"/>
+        <xsl:with-param name="high_bound" select="$high_bound"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+</xsl:stylesheet>
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/WWW/2001/10/str-util.xsl	Wed Sep 28 10:30:22 2011 -0400
@@ -0,0 +1,201 @@
+<?xml version="1.0"?>
+<!--
+$Id: str-util.xsl,v 1.19 2005/11/02 15:53:56 matthieu Exp $
+
+This XSLT stylesheet offers functions to manipulate strings
+-->
+<?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 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://www.w3.org/2001/10/str-util.xsl" version="1.0">
+
+<div xmlns="http://www.w3.org/1999/xhtml">
+           <h1>
+    <a href="http://www.w3.org/">
+      <img src="http://www.w3.org/Icons/w3c_home" alt="W3C" />
+    </a>
+
+    XSLT Templates to manipulate strings</h1>
+    <h2>Status</h2>
+    <p>The templates in this stylesheet are used in several other ones. Please don't modify it without letting me know and don't break the current exposed API.</p>
+    <h2>Variables</h2>
+    <dl>
+    <dt>str:uc</dt>
+    <dd>L'ensemble des lettres en majuscule (pratique pour conversion majuscule-minuscule)</dd>
+    <dt>str:lc</dt>
+    <dd>L'ensemble des lettres en minuscule (pratique pour conversion majuscule-minuscule)</dd>
+    </dl>
+    <h2>Templates</h2>
+
+    <dl>
+        <dt>str:keep-before</dt>
+        <dd>Takes a <var>string</var> and a <var>delimiter</var> parameters and returns the part of the string before the first appearance of <var>delimiter</var> in <var>string</var>, the complete <var>string</var> if <var>delimiter</var> is not in <var>string</var>.</dd>
+	<dt>str:ends-with</dt>
+	<dd>Takes a <var>string</var> and a <var>string2</var> parameters and returns <code>yes</code> if <var>string</var> ends with <var>string2</var>, nothing otherwise (please use <code>normalize-space()</code> on the results to avoid bad surprises</dd>
+    <dt>str:has-token</dt>
+    <dd>Takes a <var>string</var>, a <var>token</var> and an optinal <var>delimiter</var> (default at " ") parameters and returns if <var>token</var> is a token of <var>string</var> delimited by <var>delimiter</var> the value <var>token</var>, nothing (that is, an unspecified number of spaces; please use <code>normalize-space()</code> on the results to avoid bad surprises) else.</dd>
+<dt>str:keep-before-last</dt>
+        <dd>Takes a <var>string</var> and a <var>delimiter</var> parameters and returns the part of the string before the last appearance of <var>delimiter</var> in <var>string</var>, the complete <var>string</var> if <var>delimiter</var> is not in <var>string</var>.</dd>
+<dt>str:replace</dt>
+        <dd>Takes a <var>string</var>, and replace every occurence of the <var>toBeReplaced</var> parameter by the <var>replaceBy</var> parameter.</dd>
+<dt>str:stripElements</dt>
+        <dd>Takes a <var>string</var> and return it without the tags between <code>&lt;</code> and <code>&gt;</code>.</dd>
+
+    </dl>
+<hr/>
+<address>$Id: str-util.xsl,v 1.19 2005/11/02 15:53:56 matthieu Exp $<br/><a href="../../People/Dom/">Dominique Hazael-Massieux</a></address>
+<hr/>
+</div>
+
+  <xsl:variable name="str:uc">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
+
+  <xsl:variable name="str:lc">abcdefghijklmnopqrstuvwxyz</xsl:variable>
+
+
+
+  <xsl:template name="str:keep-before">
+    <xsl:param name="string"/>
+    <xsl:param name="delimiter"/>
+    <xsl:choose>
+      <xsl:when test="$string">
+        <xsl:choose>
+          <xsl:when test="contains($string,$delimiter)">
+            <xsl:value-of
+            select="normalize-space(substring-before($string,$delimiter))" />
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="normalize-space($string)" />
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="normalize-space($string)" />
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="str:ends-with">
+    <xsl:param name="string"/>
+    <xsl:param name="string2"/>
+    <xsl:if test="contains($string,$string2)">
+      <xsl:variable name="length" select="string-length($string)"/>
+      <xsl:variable name="suffix_length" select="string-length($string2)"/>
+      <xsl:if test="boolean(substring($string,number($length - 
+$suffix_length + 1))=$string2)">
+        <xsl:text>yes</xsl:text>
+      </xsl:if>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="str:has-token">
+    <xsl:param name="string"/>
+    <xsl:param name="token"/>
+    <xsl:param name="delimiter" select="' '"/>
+    <xsl:if test="$string=$token or starts-with($string,concat($token,$delimiter)) or contains($string,concat($delimiter,$token,$delimiter)) or (contains($string,concat($delimiter,$token)) and substring($string,string-length($string) - string-length($token) - string-length($delimiter) + 1)=concat($delimiter,$token))"><xsl:value-of select="$token"/></xsl:if>
+  </xsl:template>
+
+  <xsl:template name="str:keep-before-last">
+    <xsl:param name="string"/>
+    <xsl:param name="delimiter"/>
+    <xsl:choose>
+      <!-- If the string is empty, we don't need to go further (@@@ really?)-->
+      <xsl:when test="$string">
+        <xsl:choose>
+          <!-- Does the string contains the said delimiter? -->
+          <xsl:when test="contains($string,$delimiter)">
+            <xsl:choose>
+              <!-- Does the part of the string after the delimiter still contains the delimiter? -->
+              <xsl:when test="contains(substring-after($string,$delimiter),$delimiter)">
+                <!-- if yes, we concatene the first part of the string with the result of the (recursive) call to this template on the second part of the string -->
+                <xsl:value-of select="concat(substring-before($string,$delimiter),$delimiter)"/><xsl:call-template name="str:keep-before-last">
+                <xsl:with-param name="string" select="substring-after($string,$delimiter)"/>
+                <xsl:with-param name="delimiter" select="$delimiter"/>
+              </xsl:call-template>
+              </xsl:when>
+              <xsl:otherwise>
+                <!-- Otherwise, we have delimited what we want -->
+                <xsl:value-of
+            select="substring-before($string,$delimiter)" />
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:otherwise>
+            <!-- The delimiter is not in the string, end of story -->
+            <xsl:value-of select="$string" />
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <!-- If the string has a null value, we just send it back as is -->
+        <xsl:value-of select="$string" />
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="str:replace">
+    <xsl:param name="string"/>
+    <xsl:param name="toBeReplaced"/>
+    <xsl:param name="replaceBy"/>
+    <xsl:choose>
+      <!-- If the string or the toBeReplaced parameter is empty, we don't need to go further -->
+      <xsl:when test="$string and $toBeReplaced">
+        <xsl:choose>
+          <!-- Does the string contains the substring we want to replace? -->
+          <xsl:when test="contains($string,$toBeReplaced)">
+            <xsl:choose>
+              <!-- Does the part of the string after the delimiter still contains the delimiter? -->
+              <xsl:when test="contains(substring-after($string,$toBeReplaced),$toBeReplaced)">
+                <!-- if yes, we concatene the first part of the string with the string replaceBy -->
+                <!-- and the result of the (recursive) call to this template on the second part of the string -->
+                <xsl:value-of select="concat(substring-before($string,$toBeReplaced),$replaceBy)"/>
+                <xsl:call-template name="str:replace">
+                  <xsl:with-param name="string" select="substring-after($string,$toBeReplaced)"/>
+                  <xsl:with-param name="toBeReplaced" select="$toBeReplaced"/>
+                  <xsl:with-param name="replaceBy" select="$replaceBy"/>
+                </xsl:call-template>
+              </xsl:when>
+              <xsl:otherwise>
+                <!-- Otherwise, we have delimited what we want -->
+                <xsl:value-of select="concat(substring-before($string,$toBeReplaced),$replaceBy)"/>
+                <xsl:value-of select="substring-after($string,$toBeReplaced)" />
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:otherwise>
+            <!-- The substring we want to replace is not in the string, end of story -->
+            <xsl:value-of select="$string" />
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <!-- If the string has a null value, we just send it back as is -->
+        <xsl:value-of select="$string" />
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+ <xsl:template name="str:stripElements">
+   <xsl:param name="string"/>
+   <xsl:variable name="before" select="substring-before($string,'&lt;')"/>
+   <xsl:choose>
+     <xsl:when test="$before or starts-with($string,'&lt;')">
+       <xsl:value-of select="$before"/>
+       <xsl:variable name="after"  select="substring-after($string,'&lt;')"/>
+       <xsl:variable name="tag"  select="substring-before($after,'&gt;')"/>
+       <xsl:choose>
+	 <xsl:when test="$tag">
+	   <xsl:call-template name="str:stripElements">
+	     <xsl:with-param name="string" select="substring-after($after,'&gt;')"/>
+	   </xsl:call-template>
+	 </xsl:when>
+	 <xsl:otherwise>
+	   TAG is not closed properly.
+	 </xsl:otherwise>
+       </xsl:choose>
+     </xsl:when>
+     <xsl:otherwise>
+       <xsl:value-of select="$string"/>
+     </xsl:otherwise>
+   </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/WWW/2001/11/http-head.xsl	Wed Sep 28 10:30:22 2011 -0400
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<!--
+$Id: http-head.xsl,v 1.10 2002/05/22 18:40:57 dom Exp $
+-->
+<?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 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+version="1.0"
+xmlns:html="http://www.w3.org/1999/xhtml"
+xmlns:http="http://www.w3.org/2001/11/http-head.xsl"
+xmlns:str="http://www.w3.org/2001/10/str-util.xsl">
+<xsl:import href="http://www.w3.org/2001/10/str-util.xsl"/>
+  <div xmlns="http://www.w3.org/1999/xhtml">
+    <h1>
+    <a href="http://www.w3.org/">
+      <img src="http://www.w3.org/Icons/w3c_home" alt="W3C" />
+    </a>
+    XSLT Templates to get the value of some HTTP headers
+    </h1>
+
+    <h2>Status</h2>
+
+    <p>The templates in this stylesheet are used in several other
+    ones. Please don't modify it without letting me know and don't
+    break the current exposed API in any case.</p>
+
+    <h2>Templates</h2>
+    <p>Note that to be used, this stylesheet needs online resources.</p>
+    <dl>
+      <dt>http:get-header</dt>
+      <dd>Takes the URI of the document to get the header from (<var>doc_uri</var>) and the header to be extracted (<var>header_name</var>) and gives the value of this header.</dd>
+      <dt>http:get-content-type</dt>
+      <dd>Takes the URI of the document to get the header from (<var>doc_uri</var>) and gives the content-type of the given resource (you can precise if you want the parameters or not with a variable <var>with-param</var> which takes the value <code>yes</code> or <code>no</code>)</dd>
+      <dt>http:get-etag</dt>
+      <dd>Takes the URI of the document to get the header from (<var>doc_uri</var>) and gives the ETag HTTP Header of the given resource</dd>
+      <dt>http:get-status-code</dt>
+      <dd>Takes the URI of the document at <var>doc_uri</var> and outputs the HTTP status code for this URI (200, 404, ...)</dd>
+    </dl>
+    <h2>References</h2>
+    <ul>
+	<li><a href="/2001/10/xslt-toolbox.html">the XSLT Toolbox</a></li>
+    </ul>
+
+    <hr />
+
+    <address>$Id: http-head.xsl,v 1.10 2002/05/22 18:40:57 dom Exp $
+    <br />
+
+    <a href="../../People/Dom/">Dominique Hazael-Massieux</a>
+    </address>
+
+    <hr />
+</div>
+<xsl:template name="http:get-header">
+  <xsl:param name="doc_uri"/>
+  <xsl:param name="header_name"/>
+  <xsl:if test="starts-with($doc_uri,'http://')">
+    <xsl:value-of select="document(concat('http://cgi.w3.org/cgi-bin/headers?url=',$doc_uri))/html:html/html:body/html:pre/html:span[@class='headername' and .=$header_name][position()=last()]/following::html:span[@class='headervalue'][1]"/>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="http:get-content-type">
+  <xsl:param name="doc_uri"/>
+  <xsl:param name="with-param">yes</xsl:param>
+  <xsl:variable name="header"><xsl:call-template name="http:get-header"><xsl:with-param name="doc_uri" select="$doc_uri"/><xsl:with-param name="header_name">Content-Type</xsl:with-param></xsl:call-template></xsl:variable>
+  <xsl:choose><xsl:when test="$with-param='yes'"><xsl:value-of select="$header"/></xsl:when><xsl:otherwise><xsl:call-template name="str:keep-before"><xsl:with-param name="string" select="$header"/><xsl:with-param name="delimiter">;</xsl:with-param></xsl:call-template></xsl:otherwise></xsl:choose>
+</xsl:template>
+
+<xsl:template name="http:get-etag">
+  <xsl:param name="doc_uri"/>
+  <xsl:call-template name="http:get-header">
+    <xsl:with-param name="header_name">
+      <xsl:text>Etag</xsl:text>
+    </xsl:with-param>
+    <xsl:with-param name="doc_uri" select="$doc_uri"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="http:get-status-code">
+  <xsl:param name="doc_uri"/>
+  <xsl:if test="starts-with($doc_uri,'http://')">
+    <xsl:value-of select="document(concat('http://cgi.w3.org/cgi-bin/headers?url=',$doc_uri))/html:html/html:body/html:pre/html:span[@class='errcode'][position()=last()]"/>
+  </xsl:if>
+</xsl:template>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/WWW/2001/11/is-valid.xsl	Wed Sep 28 10:30:22 2011 -0400
@@ -0,0 +1,140 @@
+<?xml version="1.0"?>
+<?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"?>
+<!--
+$Id: is-valid.xsl,v 1.34 2006/01/30 18:29:49 matthieu Exp $
+-->
+<?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 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+version="1.0"
+xmlns:html="http://www.w3.org/1999/xhtml"
+xmlns:vld="http://www.w3.org/2001/11/is-valid.xsl" exclude-result-prefixes="vld html">
+
+<!-- Tests run when in units test mode -->
+<tests xmlns="http://www.w3.org/2001/11/is-valid.xsl">
+  <test>
+    <uri>http://www.w3.org/</uri>
+    <HTMLvalid>OK</HTMLvalid>
+    <CSSvalid>OK</CSSvalid>
+  </test>
+  <!-- update as needed -->
+  <test>
+    <uri>http://www.lucent.com/</uri>
+    <HTMLvalid>Error</HTMLvalid>
+    <CSSvalid>OK</CSSvalid>
+  </test>
+  <test>
+    <uri>http://lists.w3.org/Archives/Public/www-qa/2005Feb/0032.html</uri>
+    <HTMLvalid>OK</HTMLvalid>
+    <CSSvalid>Error</CSSvalid>
+  </test>
+</tests>
+
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <link rel="stylesheet" href="http://www.w3.org/StyleSheets/base"/>
+    <title>Templates to get validity results</title>
+  </head>
+  <body>
+    <div class='head'><a href="/"><img src="/Icons/w3c_home" alt="W3C"/></a> | <a href="../../2001/10/xslt-toolbox">XSLT toolbox</a></div>
+
+    <h1>
+    Templates to get validity results
+    </h1>
+
+    <h2>Status</h2>
+
+    <p>The templates in this stylesheet are used in several other
+    ones. Please don't modify it without letting me know and don't
+    break the current exposed API in any case.</p>
+
+    <p>It comes with a Unit test, to allow easier debugging; the test is obtained by running the style sheet against any XML, and the output is given through <code>xsl:message</code>.</p>
+
+    <h2>Templates</h2>
+    <p>Note that to be used, this stylesheet needs online resources.</p>
+    <dl>
+      <dt>vld:is-html-valid</dt>
+      <dd>Takes a <var>doc_uri</var> parameter with the URI of the document to be checked against HTML validity and returns <code>yes</code>, <code>no</code> or <code>tocheck</code> when the result is not understandable</dd>
+      <dt>vld:is-css-valid</dt>
+      <dd>Takes a <var>doc_uri</var> parameter with the URI of the document to be checked against CSS validity and returns <code>yes</code>, <code>no</code> or <code>tocheck</code> when the result is not understandable</dd>
+    </dl>
+
+    <hr />
+
+    <address>$Id: is-valid.xsl,v 1.34 2006/01/30 18:29:49 matthieu Exp $
+    <br />
+
+    <a href="../../People/Dom/">Dominique Hazael-Massieux</a>
+    </address>
+    
+  </body>
+</html>
+
+<!-- For the Unit Test -->
+<xsl:template match="/">
+  <xsl:message>Starting</xsl:message>
+  <xsl:for-each select="document('')/xsl:stylesheet/vld:tests/vld:test">
+      <xsl:message>Running test # <xsl:value-of select="position()"/>: <xsl:value-of select="vld:uri"/></xsl:message>
+    <xsl:variable name="HTMLresult">
+      <xsl:call-template name="vld:is-html-valid">
+        <xsl:with-param name="doc_uri" select="vld:uri"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="CSSresult">
+      <xsl:call-template name="vld:is-css-valid">
+        <xsl:with-param name="doc_uri" select="vld:uri"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="vld:HTMLvalid!=$HTMLresult">
+        <xsl:message>-&gt; HTML validation failed: got <xsl:value-of select="$HTMLresult"/>, expected <xsl:value-of select="vld:HTMLvalid"/></xsl:message>
+      </xsl:when>
+      <xsl:when test="vld:CSSvalid!=$CSSresult">
+        <xsl:message>-&gt; CSS validation failed: got <xsl:value-of select="$CSSresult"/>, expected <xsl:value-of select="vld:CSSvalid"/></xsl:message>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message>success!</xsl:message>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:for-each>
+</xsl:template>
+
+
+
+<xsl:template name="vld:is-html-valid">
+  <xsl:param name="doc_uri"/>
+  <xsl:variable name="result" select="document(concat('http://cgi.w3.org/cgi-bin/tidy?docAddr=http://validator.w3.org/check?uri=',$doc_uri))/html:html/html:body"/>
+  <xsl:choose>
+    <xsl:when test="$result//html:div[@id='result']/child::html:h2[@class='valid']">OK</xsl:when>
+    <xsl:otherwise>
+      <a href="http://validator.w3.org/check?uri={$doc_uri}">
+        <xsl:choose>
+          <xsl:when test="$result//html:div[@id='result']/child::html:h2[@class='invalid']">Error</xsl:when>
+          <xsl:otherwise>Markup Validation Service</xsl:otherwise>
+        </xsl:choose>
+      </a>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="vld:is-css-valid"  xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m="http://www.w3.org/2005/07/css-validator">
+  <xsl:param name="doc_uri"/>
+  <!-- Using SOAP output of the CSS Validator -->
+  <xsl:variable name="result" select="document(concat('http://jigsaw.w3.org/css-validator/validator?usermedium=all&amp;output=soap12&amp;uri=',$doc_uri))/env:Envelope/env:Body/m:cssvalidationresponse/m:validity"/>
+  <xsl:choose>
+    <xsl:when test="$result='true'">OK</xsl:when>
+    <xsl:otherwise>
+      <a href="http://jigsaw.w3.org/css-validator/validator?uri={$doc_uri}">
+        <xsl:choose>
+          <xsl:when test="$result='false'">Error</xsl:when>
+          <xsl:otherwise>CSS Validation Service</xsl:otherwise>
+        </xsl:choose>
+      </a>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/WWW/2005/09/checker/pubrules-tests.xsl	Wed Sep 28 10:30:22 2011 -0400
@@ -0,0 +1,1899 @@
+<?xml version="1.0"?>
+<!-- 
+The aim of this stylesheet is to provides a set of tests to be used to check 
+publrules compliance of an xhtml document.
+
+$Id: pubrules-tests.xsl,v 1.847 2011/09/23 16:41:40 ijacobs Exp $
+
+-->
+
+<!-- 
+<?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 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" 
+	xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:html="http://www.w3.org/1999/xhtml"
+        xmlns:uri="http://www.w3.org/2000/07/uri43/uri.xsl?template="
+	xmlns:trd="http://www.w3.org/2001/10/trdoc-data.xsl"
+	xmlns:str="http://www.w3.org/2001/10/str-util.xsl"
+	xmlns:vld="http://www.w3.org/2001/11/is-valid.xsl"
+	xmlns:http="http://www.w3.org/2001/11/http-head.xsl"
+        xmlns:pubutils='http://www.w3.org/2005/09/checker/utils'
+	xmlns:pub-tests="http://www.w3.org/2005/09/checker/pubrules-tests.xsl"
+	xmlns:wsn='http://www.w3.org/2005/09/checker/ws-normalize'
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	exclude-result-prefixes="html uri trd str vld http pub-tests pubutils wsn xs"
+        xmlns:exsl="http://exslt.org/common"
+        extension-element-prefixes="exsl">
+
+  <xsl:import href="http://www.w3.org/2001/10/str-util.xsl" />
+  <xsl:import href="http://www.w3.org/2001/10/trdoc-data.xsl" />
+  <xsl:import href="http://www.w3.org/2001/11/is-valid.xsl" />
+  <xsl:import href="http://www.w3.org/2001/11/http-head.xsl" />
+  <xsl:import href="http://www.w3.org/2000/07/uri43/uri.xsl" />
+  <xsl:import href="ws-normalize.xsl" />
+  <xsl:import href="utils.xsl" />
+
+  <xsl:output method="xml" encoding='utf-8' version="1.0"/>
+
+<!-- doc_uri is the URI of the document -->
+  <xsl:param name="doc_uri"/>
+  <xsl:param name="xmlfile"/>
+  <xsl:param name="docstatus"/>
+  <xsl:param name="rectrack"/>
+  <xsl:param name="prevrec"/>
+  <xsl:param name="patpol"/>
+  <xsl:param name="normative"/>
+  <xsl:param name="year"/>
+  <xsl:param name="recursive"/>
+  <xsl:param name="nscheckmanual"/>
+  <xsl:param name="debug" select="0"/>
+
+  <xsl:variable name="short_status" select="trd:getShortStatus()"/>
+
+  <!-- Use the pubutils UI here since docstatus controls status at
+  this point: either set through UI or calculated automatically -->
+
+  <xsl:variable name="isLastCall" select="pubutils:isLastCall($docstatus)"/>
+  <xsl:variable name="isFirstPublicWorkingDraft"  select="pubutils:isFirstPublicWorkingDraft($docstatus)" as="xs:boolean"/>
+  <xsl:variable name="isSubmission" select="pubutils:isSubmission($docstatus)" as="xs:boolean"/>
+  <xsl:variable name="isNote" select="pubutils:isNote($docstatus)" as="xs:boolean"/>
+  <xsl:variable name="isFirstPublicNote" select="pubutils:isFirstPublicNote($docstatus)" as="xs:boolean"/>
+
+  <xsl:variable name="isXGR" select="pubutils:isXGR($docstatus)" as="xs:boolean"/>
+
+  <xsl:variable name="origin">
+    <xsl:call-template name="trd:getOrigin"/>
+  </xsl:variable>
+
+  <xsl:variable name="css_suffix">
+    <xsl:if test="$isSubmission or $isNote">
+      <xsl:value-of select="$origin"/>
+      <xsl:text>-</xsl:text>
+    </xsl:if>    <xsl:value-of select="$short_status"/>
+  </xsl:variable>
+
+  <xsl:variable name="title" select="trd:getTitle(root())"/>
+  <xsl:variable name="this_version" select="trd:thisVersionURI()"/>
+  <xsl:variable name="latest_version" select="trd:latestVersionURI()"/>
+  <xsl:variable name="previous_version" select="trd:previousVersionURI()"/>
+  <xsl:variable name="date_status" select="trd:getNumericDate()"/>
+  <xsl:variable name="editors_section" select="trd:getEditorsSectionName()"/>
+  <xsl:variable name="SOTD" select="trd:getStatusSection()"/>
+  <xsl:variable name="TextOfSOTD" select="$status-as-string"/>
+
+  <xsl:variable name="ImplOrInteropLinkInSOTD">
+    <xsl:if test="not($isSubmission)">
+      <xsl:for-each select="$SOTD/descendant::html:a">
+	<xsl:if test="matches(.,'implementation|interoperability','i')">
+	  <a href="{@href}"><xsl:value-of select="@href"/></a>, 
+	</xsl:if>
+      </xsl:for-each>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="FeedbackInSOTD">
+    <xsl:if test="not($isSubmission)">
+      <xsl:for-each select="$SOTD/descendant::html:a">
+	<xsl:if test="starts-with(@href,'mailto:')">
+	  <xsl:value-of select="substring-after(@href,'mailto:')"/>, 
+	</xsl:if>
+      </xsl:for-each>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="MLArchivesInSOTD">
+    <xsl:if test="not($isSubmission)">
+      <xsl:for-each select="$SOTD/descendant::html:a">
+	<xsl:if test="starts-with(@href,'http://lists.w3.org/Archives/Public/')">
+	  <xsl:value-of select="@href"/>, 
+	</xsl:if>
+      </xsl:for-each>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="FeedBackDue" select="trd:getFeedbackDueDate()"/>
+
+  <xsl:variable name="workinggroup_uris">
+    <xsl:if test="$SOTD">
+      <xsl:variable name="var">
+	<xsl:call-template name="trd:getWorkingGroup"/>
+      </xsl:variable>
+      <xsl:value-of select="normalize-space(string-join(distinct-values(tokenize(replace(normalize-space($var),',\s*$',''),',\s*')),','))"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="workinggroup_count">
+    <!-- remove any trailing commas -->
+    <!-- Count distinct home page values -->
+    <xsl:value-of select="count(tokenize($workinggroup_uris,','))"/>
+  </xsl:variable>
+
+  <xsl:variable name="HTMLValidatorResults">
+    <xsl:copy-of select="document(concat('http://validator.w3.org/check?uri=',$doc_uri))/html:html/html:body"/>
+  </xsl:variable>
+  
+  <xsl:variable name="HTMLValidity">
+    <xsl:choose>
+      <xsl:when test="$HTMLValidatorResults">
+	<xsl:choose>
+	  <xsl:when test="$HTMLValidatorResults//html:h2[@class='valid']">OK</xsl:when>
+	  <xsl:when test="$HTMLValidatorResults//html:h2[@class='invalid']">Error</xsl:when>
+	  <xsl:otherwise><a href="http://validator.w3.org/check?uri={$doc_uri}">Markup Validation Service</a></xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<a href="http://validator.w3.org/check?uri={$doc_uri}">Markup Validation Service</a>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="HTMLDoctype">
+      <xsl:if test="$HTMLValidatorResults">
+	<xsl:variable name="tr-doctype" select="$HTMLValidatorResults//html:tr[html:th/html:label[@for='doctype']]"/>
+	<xsl:value-of select="normalize-space($tr-doctype/*[2])"/>
+      </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="CSSValidity">
+    <xsl:call-template name="vld:is-css-valid">
+      <xsl:with-param name="doc_uri" select="$doc_uri"/>
+    </xsl:call-template>
+  </xsl:variable>
+    
+  <xsl:variable name="shortname" select="trd:getShortNameFromUndated($latest_version)"/>
+
+
+<!-- Each template matches one (or severals) requirement(s) in the pubrules (http://www.w3.org/Guide/pubrules) -->
+
+<!-- Check if one normative representation is available for requests that use the "This Version" URI -->
+  <xsl:template name="normativeVersionTest">
+      <!-- Not checked --> 
+  </xsl:template>
+
+<!-- Check if all normative representations are HTML 4.x or XHTML valide -->
+  <xsl:template name="valideHTMLTest">
+    <xsl:choose>
+      <xsl:when test="contains($HTMLValidity,'OK')">
+        <span class="yes">OK</span>
+	The <a href="http://validator.w3.org/">W3C Markup Validation
+	Service</a> was used for the <span class="tool"><a
+	href="http://validator.w3.org/check?uri={$doc_uri}">validation
+	of this document</a></span>.
+      </xsl:when>
+      <xsl:when test="contains($HTMLValidity,'Error')">
+        <span class="no">Error</span>
+	The <a href="http://validator.w3.org/">W3C Markup Validation
+	Service</a> was used for the <span class="tool"><a
+	href="http://validator.w3.org/check?uri={$doc_uri}">validation
+	of this document</a></span>.
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="tool"><xsl:copy-of select="$HTMLValidity"/></span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Check if one normative representation validates as HTML 4.x or XHTML 1.0 (for backwards compatibility) -->
+<xsl:template name="valideBackwardTest">
+  <xsl:choose>
+    <xsl:when test="string-length($HTMLDoctype) &gt; 1">
+      <xsl:choose>
+	<xsl:when test="pubutils:isRec($docstatus)">
+	  <xsl:choose>
+	    <xsl:when test="matches($HTMLDoctype,'^HTML\s+4.+','i') or
+			    matches($HTMLDoctype,'^XHTML\s+1\.0.+','i')
+			    ">
+	      <span class="yes">OK</span> (found <xsl:value-of select="$HTMLDoctype"/>)
+	      The <a href="http://validator.w3.org/">W3C Markup Validation
+	      Service</a> was used for the <span class="tool"><a
+	      href="http://validator.w3.org/check?uri={$doc_uri}">validation
+	      of this document</a></span>. 
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <span class="warning">Warning</span> The DOCTYPE found was:
+	      <xsl:value-of select="$HTMLDoctype"/>, which is not one
+	      of the required DOCTYPEs.
+	      The <a href="http://validator.w3.org/">W3C Markup Validation
+	      Service</a> was used for the <span class="tool"><a
+	      href="http://validator.w3.org/check?uri={$doc_uri}">validation
+	      of this document</a></span>. 
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:choose>
+	    <!-- Note: XHTML 1.1 is a subset of XHTML+RDFa; pubrules
+	    doesn't mention XHTML 1.1 explicitly yet, but the checker
+	    is updated to allow it-->
+	    <xsl:when test="matches($HTMLDoctype,'^HTML\s+4.+','i') or
+			    matches($HTMLDoctype,'^XHTML\s+1\.0.+','i') or
+			    matches($HTMLDoctype,'^XHTML\s+1\.1.+','i') or
+			    matches($HTMLDoctype,'^XHTML\s*\+\s*RDFa.*','i')
+			    ">
+	      <span class="yes">OK</span> (found <xsl:value-of select="$HTMLDoctype"/>)
+	      The <a href="http://validator.w3.org/">W3C Markup Validation
+	      Service</a> was used for the <span class="tool"><a
+	      href="http://validator.w3.org/check?uri={$doc_uri}">validation
+	      of this document</a></span>. 
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <span class="warning">Warning</span> The DOCTYPE found was:
+	      <xsl:value-of select="$HTMLDoctype"/>, which is not one
+	      of the required DOCTYPEs.
+	      The <a href="http://validator.w3.org/">W3C Markup Validation
+	      Service</a> was used for the <span class="tool"><a
+	      href="http://validator.w3.org/check?uri={$doc_uri}">validation
+	      of this document</a></span>. 
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <a href="http://validator.w3.org/check?uri={$doc_uri}">W3C Markup Validation
+      Service</a>; not called since no DOCTYPE found.
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+  <!-- Check that the correct W3C style sheet is called wrt status -->
+  <xsl:template name="goodStylesheetTest">
+    <xsl:param name="boilerplate"/>
+    <xsl:variable name="styleuri" select="/html:html/html:head/html:link[@rel='stylesheet'][starts-with(@href,'http://www.w3.org/StyleSheets/TR/W3C-')]/@href"/>
+    <xsl:choose>
+      <xsl:when test="$styleuri and (($styleuri=$boilerplate) or ($styleuri=concat($boilerplate,'.css')))">
+	<span class="yes">OK</span>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span>. 
+	The W3C style sheet should be <xsl:value-of select="$boilerplate" />. 
+	<xsl:choose>
+	  <xsl:when test="normalize-space($styleuri)=''">
+	    No style sheet found.
+	  </xsl:when>
+	  <xsl:otherwise>
+	    It is currently <xsl:value-of select="$styleuri" />.
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <!--
+  There must be an absolute link to the appropriate
+  technical report style sheet as follows. Any internal style sheets are
+  cascaded before this link; i.e. the internal style sheets must not override the W3C tech report styles.
+  -->
+  <xsl:template name="lastStylesheetTest">
+      <span class="test">Is the last style sheet used the W3C one? </span>
+      <xsl:variable name="styleuri" select="/html:html/html:head/html:link[@rel='stylesheet'][position()=last()][starts-with(@href,'http://www.w3.org/StyleSheets/TR/W3C-')]/@href"/>
+      <xsl:choose>
+        <xsl:when test="$styleuri!=''">
+	  <span class="yes">OK</span>
+        </xsl:when>
+        <xsl:otherwise>
+          <span class="no">Error</span> : There seems to be a style sheet link that follows the required W3C style sheet in the cascade order. Found instead <xsl:value-of select="/html:html/html:head/html:link[@rel='stylesheet'][last()]/@href"/>.
+        </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+  <!-- Check that the last style sheet called is the W3C one -->
+  <xsl:template match="html:link[@rel='stylesheet'][position()=last()]">
+    <xsl:choose>
+      <xsl:when test="starts-with(@href,'http://www.w3.org/StyleSheets/TR/W3C-') or starts-with(@href,'/StyleSheets/TR/W3C-')">
+        <xsl:choose>
+          <xsl:when test="following-sibling::html:style">
+            <span class="no">Error</span> Style element detected after the W3C style sheet
+	  </xsl:when>
+          <xsl:otherwise>
+            <span class="yes">OK</span>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="no">Error</span> Last style sheet called is 
+        <xsl:value-of select="@href" />, expecting one matching <code>http://www.w3.org/StyleSheets/TR/W3C-<var>status</var></code>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- The following markup at the beginning of the head of the document: <div class="head"> -->
+  <xsl:template name="divClassHeadTest">
+    <span class="test">Is there a &lt;div class="head"&gt; section? </span>
+    <xsl:choose>
+      <xsl:when test="$trd:divHead">
+	<span class="yes">OK</span>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="no">Error</span> No <code>div</code> element with 
+        <code>class="head"</code> found.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="logoTest">
+    <xsl:param name="boilerplate"/>
+    <xsl:choose>
+      <xsl:when test="$trd:divHead">
+	<xsl:variable name="logouri" select="$boilerplate//html:img/@src"/>
+	<xsl:variable name="srclink" select="$trd:divHead//html:a[html:img[normalize-space(@src)=$logouri]]"/>
+        <xsl:choose>
+	  <xsl:when test="count($srclink)=0">
+	    <span class="no">Error</span>. No link to logo found that is a
+	    descendent of the <code>div</code> element with <code>class="head"</code>.
+	  </xsl:when>
+          <xsl:when test="deep-equal(wsn:deep-normalize-space($srclink),wsn:deep-normalize-space($boilerplate))">
+            <span class="yes">OK</span>
+          </xsl:when>
+          <xsl:otherwise>
+            <span class="no">Error</span>. Expected logo markup not found.
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="no">Error</span> No <code>div</code> element
+	with <code>class="head"</code> found.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- The document's title is in the title element and an h1 element. -->
+  <xsl:template name="titleTest">
+    <xsl:choose>
+      <xsl:when test="$trd:divHead">
+	<xsl:variable name="h1node" select="$trd:divHead//html:h1"/>
+	<xsl:choose>
+	  <xsl:when test="count($h1node)=0">
+	    <span class="no">Error</span> No <code>h1</code> element found
+	    that is a descendent of a <code>div</code> with <code>class="head"</code>.
+	  </xsl:when>
+	  <xsl:when test="normalize-space($h1node)=normalize-space($title)">
+	    <span class="yes">OK</span> (found "<xsl:value-of select="$h1node"/>")
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <span class="no">Error</span> : 
+	    <pre><xsl:value-of select="normalize-space($h1node)" /></pre>
+	    different from 
+	    <pre><xsl:value-of select="normalize-space($title)" /></pre>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span> No <code>div</code> element
+	with <code>class="head"</code> found.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- The document's status and date MUST be in an h2 element. -->
+<xsl:template name="dateTitleH2Test">
+  <span class="test">Is the dated status h2 title correct? </span>
+  <xsl:choose>
+    <!-- $status comes from trdoc-data.xsl -->
+    <xsl:when test="$status=''">
+      <span class="no">Error</span>: No appropriate document status
+      found within <code>h2</code>.
+      <xsl:if test="$trd:divHead//html:h2">
+	Did find the following:
+	<xsl:for-each select="$trd:divHead//html:h2">
+	  <code><xsl:value-of select="."/></code>
+	  <xsl:if test="position()!=last()">, </xsl:if>
+	</xsl:for-each>
+      </xsl:if>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="firsth2"  select="$trd:divHead//html:h2[matches(normalize-space(.),$status)]"/>
+      <xsl:choose>
+	<xsl:when test="count($firsth2) eq 0">
+	  <span class="no">Error</span>: No h2 found with the indicated
+	  document status.
+	</xsl:when>
+	<xsl:when test="count($firsth2) gt 1">
+	  <span class="no">Error</span>: More than one h2 found with the indicated
+	  document status (<xsl:value-of select="$status"/>)
+	  <xsl:for-each select="$firsth2">
+	    <code><xsl:value-of select="."/></code>
+	    <xsl:if test="position()!=last()">, </xsl:if>
+	  </xsl:for-each>
+	</xsl:when>
+	<xsl:when test="not(matches(normalize-space($firsth2),'^W3C\s(Recommendation|Proposed Recommendation|Proposed Edited Recommendation|Candidate Recommendation|Working Draft|Working Group Note|Interest Group Note|Coordination Group Note|Member Submission|Team Submission|Incubator Group Report)(\s—\s|[,]\s|\s)[0-9].+','i'))">
+	  <span class="no">Error</span>: Status line does not match expected status string. Found <code><xsl:value-of select="$firsth2"/></code>.
+	  <xsl:if test="matches($firsth2,'Last\sCall','i')">
+	    Hint: Do not include "Last Call" in the h2.
+	  </xsl:if>
+	  <xsl:if test="matches($firsth2,'Editor','i')">
+	    Hint: The problem may go away by removing the "Editor"
+	    parts in the h2.
+	  </xsl:if>
+	</xsl:when>
+	<!-- Add a test here: if not exact match then warning -->
+	<xsl:otherwise>
+	  <span class="yes">OK</span> (<xsl:value-of select="$firsth2" />)
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- Version Links (could be improved). -->
+
+  <xsl:template name="docIDFormat">
+    <xsl:choose>
+      <xsl:when test="not(normalize-space($this_version))">
+        <span class="no">Error</span>: "This version" link not found
+      </xsl:when>
+      <xsl:when test="not(normalize-space($latest_version))">
+        <span class="no">Error</span>: "Latest version" link not found
+      </xsl:when>
+      <xsl:when test="not(normalize-space($previous_version))">
+	<xsl:choose>
+	  <xsl:when test="$isFirstPublicWorkingDraft or
+			  $isFirstPublicNote">
+	    <span class="yes">OK</span>
+	  </xsl:when>
+	  <xsl:when test="pubutils:isMemberSubmission($docstatus) or
+                          pubutils:isTeamSubmission($docstatus) or
+                          $isXGR">
+	    <span class="yes">OK</span> (no "Previous Version" URI found but not required for this type of document)
+          </xsl:when>
+          <xsl:otherwise>
+            <span class="no">Error</span>: "Previous version" link not found
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+	  <xsl:when test="pubutils:isWorkingDraftButNotFirst($docstatus)
+			  and matches($previous_version,'REC-')">
+	    <span class="warning">Warning</span>. This is Working Draft
+	    and the previous version seems to be a Recommendation
+	    (<xsl:value-of select="$previous_version"/>). 
+	    If this is a First Public Working Draft of a revised Recommendation, do not link to the previous Recommendation as the previous version. Instead, describe the relationship between the documents in the status section. <span class="tocheck">Please verify</span> whether this is in fact a First Public Working Draft.
+	  </xsl:when>
+	  <xsl:when test="$isFirstPublicWorkingDraft or $isFirstPublicNote">
+	    <span class="no">Error</span>, this document has been identified as a first publication but it has a "Previous version" link (<xsl:value-of select="$previous_version"/>). If this is a First Public Working Draft of a revised Recommendation <xsl:if test="matches($previous_version,'REC-')">(and it looks like it since the previous version URI includes "REC")</xsl:if>, do not link to the previous Recommendation as the previous version. Instead, describe the relationship between the documents in the status section. <span class="tocheck">Please verify</span> and remove the previous URI from the head of the document.
+	  </xsl:when>
+	  <xsl:otherwise>
+            <span class="yes">OK</span>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+
+  </xsl:template>
+
+  <xsl:template name="docIDOrder">
+    <xsl:choose>
+      <xsl:when test="$trd:divHead">
+	<xsl:choose>
+	  <!-- "This version URI" followed by "Latest version URI(s)" for FPWD, IGR, Subm, and Team Subm -->
+	  <xsl:when test="($isFirstPublicWorkingDraft or $isFirstPublicNote or $isSubmission or $isXGR) and $trd:divHead//html:dl/html:dt[translate(normalize-space(),'V:','v')='This version']/following-sibling::html:dt[contains(normalize-space(),'Latest') and contains(translate(normalize-space(),'V:','v'),'version')]">
+	    <span class="yes">OK</span>
+	  </xsl:when>
+	  <!-- "This version URI" followed by "Latest version URI(s)" followed by "Previous version URI" -->
+	  <xsl:when test="$trd:divHead//html:dl/html:dt[translate(normalize-space(),'V:','v')='This version']/following-sibling::html:dt[contains(normalize-space(),'Latest') and contains(translate(normalize-space(),'V:','v'),'version')]/following-sibling::html:dt[starts-with(translate(normalize-space(),'V:','v'),'Previous version')]">
+	    <span class="yes">OK</span>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <span class="no">Error</span>, the order should be "This version URI", "Latest version URI(s)", "Previous version URI" (if there is a previous version).
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span> No <code>div</code> element
+	with <code>class="head"</code> found.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="docIDThisVersion">
+    <xsl:choose>
+      <xsl:when test="$trd:divHead">
+	<xsl:choose>
+	  <xsl:when test="not(matches($this_version,'^.+[/]$'))">
+	    <span class="no">Error</span> (missing required trailing slash in <xsl:value-of select="$this_version"/>; other tests not performed)
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:call-template name="checkIfHrefAndTextEqual">
+	      <xsl:with-param name="link" select="$trd:divHead//html:dt[translate(normalize-space(),'V:','v')='This version']"/>
+	    </xsl:call-template>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span> No <code>div</code> element
+	with <code>class="head"</code> found.
+      </xsl:otherwise>
+    </xsl:choose>      
+  </xsl:template>
+
+  <xsl:template name="docIDLatestVersion">
+    <xsl:choose>
+      <xsl:when test="$trd:divHead">
+	<xsl:choose>
+	  <xsl:when test="not(matches($latest_version,'^.+[/]$'))">
+	    <span class="no">Error</span> (missing required trailing slash in <xsl:value-of select="$latest_version"/>; other tests not performed)
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:call-template name="checkIfHrefAndTextEqual">
+	      <xsl:with-param name="link" select="$trd:divHead//html:dt[contains(normalize-space(),'Latest') and contains(translate(normalize-space(),'V:','v'),'version')]"/>
+	    </xsl:call-template>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span> No <code>div</code> element
+	with <code>class="head"</code> found.
+      </xsl:otherwise>
+    </xsl:choose>      
+  </xsl:template>
+
+  <!-- check that the href and the printed URIs are the same -->
+  <xsl:template name="checkIfHrefAndTextEqual">
+    <xsl:param name="link"/>
+    <xsl:choose>
+      <xsl:when test="count($link) gt 1">
+        <span class="no">Error</span> Found more than one URI: 
+	  <xsl:value-of select="$link" separator=","/>
+      </xsl:when>
+      <xsl:when test="$link/following-sibling::html:dd[1]//html:a[1]/@href=normalize-space($link/following-sibling::html:dd[1]//html:a[1])">
+        <xsl:choose>
+          <xsl:when test="matches(normalize-space($link),'^this version','i')">
+            <!-- Advanced tests for This version link -->
+            <xsl:call-template name="advancedThisVersionTests" />
+          </xsl:when>
+          <xsl:when test="matches(normalize-space($link),'^latest version','i')">
+            <!-- Advanced tests for Latest version link -->
+            <xsl:call-template name="advancedLatestVersionTests" />
+          </xsl:when>
+          <xsl:otherwise>
+            <!-- Shouldn't be here -->
+            <span class="yes">OK</span>, href and the printed URI are the same but this is neither "This version" URI nor "Latest version" URI
+            (<xsl:value-of select="$link/following-sibling::html:dd[1]//html:a[1]/@href" />)
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="no">Error</span><br />
+        <xsl:value-of select="$link/following-sibling::html:dd[1]//html:a[1]/@href" /> different from <br />
+        <xsl:value-of select="normalize-space($link/following-sibling::html:dd[1]//html:a[1])" />
+      </xsl:otherwise>
+    </xsl:choose>    
+  </xsl:template>
+
+  <xsl:template name="advancedThisVersionTests">
+    <xsl:choose>
+      <xsl:when test="$isXGR">
+	<xsl:choose>
+	  <xsl:when test="matches($this_version,concat('^http://www.w3.org/2005/Incubator/[^/]+/',$shortname,'[\-]',$year,'\d\d\d\d[/]$'))">
+	    <span class="yes">OK</span> (found <xsl:value-of select="$this_version"/>)
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <span class="no">Error</span> (found <xsl:value-of select="$this_version"/>)
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:when test="contains($this_version,concat('/',$short_status,'-')) and ($isSubmission or (starts-with($this_version,'http://www.w3.org') and substring(substring-before($this_version,'-'),27)=$short_status))">
+        <xsl:choose>
+          <xsl:when test="(not($isSubmission) and starts-with($this_version,concat('http://www.w3.org/TR/',substring($date_status,1,4),'/',$short_status,'-',$shortname,'-'))) or contains($this_version,concat('/',$short_status,'-',$shortname,'-'))">
+            <xsl:choose>
+	      <xsl:when test="$trd:divHead">
+		<xsl:choose>
+		  <xsl:when test="count($trd:divHead//html:dt[translate(normalize-space(),'V:','v')='This version']/following-sibling::html:dd[1]//html:a[@href])=1">
+		    <span class="yes">OK</span>
+		  </xsl:when>
+		  <xsl:otherwise>
+		    <span class="no">Error</span>, several links in the "this version" link. Only one is admitted. Non-normative document representations addressed elsewhere in pubrules.
+		  </xsl:otherwise>
+		</xsl:choose>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<span class="no">Error</span> No <code>div</code> element
+		with <code>class="head"</code> found.
+	      </xsl:otherwise>
+	    </xsl:choose>      
+          </xsl:when>
+
+          <xsl:otherwise>
+          <span class="no">Error</span>, the link <xsl:value-of select="following-sibling::html:dd[1]/html:a/@href"/>
+          <xsl:choose>
+            <xsl:when test="not($isSubmission)">
+              doesn't start with 
+              <code><xsl:value-of select="concat('http://www.w3.org/TR/',substring($date_status,1,4),'/',$short_status,'-',$shortname,'-')" /></code>      
+            </xsl:when>
+            <xsl:otherwise>
+              doesn't contain <code><xsl:value-of select="concat('/',$short_status,'-',$shortname,'-')"/></code>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="no">Error</span> The status found in the URI (<xsl:value-of select="$this_version"/>) doesn't match the specified short status (<xsl:value-of select="$short_status" />), or the "this version" link is not well formatted (a la http://www.w3.org/TR/<var>YYYY</var>/<var>status</var>-<var>shortname</var>-<var>YYYYMMDD</var>)</xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="advancedLatestVersionTests">
+    <xsl:variable name="previous_etag">
+      <xsl:call-template name="http:get-etag">
+        <xsl:with-param name="doc_uri" select="normalize-space($previous_version)"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="latest_etag">
+      <xsl:call-template name="http:get-etag">
+        <xsl:with-param name="doc_uri" select="normalize-space($latest_version)"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="change_of_sn">
+      <xsl:call-template name="trd:hasNewShortname"/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="normalize-space($change_of_sn)">
+        <span class="warning">Warning</span>, the shortnames are different in the previous version URI and in the latest version URI.
+	<span class="tocheck">Please verify</span> 
+       that the Director approved the new short name.
+      </xsl:when>
+      <xsl:when test="normalize-space($previous_version)!='' and not(normalize-space($latest_etag)=normalize-space($previous_etag))">
+        <span class="warning">Warning</span>, the <a href="{$previous_version}">previous version</a> doesn't seem to match with the current 
+          <a href="{$latest_version}">latest version</a> 
+          (<span class="tocheck">ETags differs : <xsl:value-of select="$previous_etag"/> / <xsl:value-of select="$latest_etag"/></span>).
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="yes">OK</span> (found <xsl:value-of select="$latest_version"/>)
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Testing if the date matches the document's date-->
+  <xsl:template name="docIDDate">
+    <xsl:variable name="date_link" select="translate(substring-after($this_version,concat($short_status,'-',$shortname,'-')),'/','')" />
+    <xsl:choose>
+      <xsl:when test="$date_status=$date_link">
+        <span class="yes">OK</span>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="no">Error</span>, the date of the document
+              (<xsl:value-of select="$date_status" />) and the one of
+              the URI (<xsl:value-of select="$date_link" />) don't
+              match (or the status subtitle is not in the expected format 
+              <em>W3C Status [D]D Month YYYY</em>)
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Check if there is an editor or author section -->
+  <xsl:template name="editorSectionTest">
+    <span class="test">Is there an Editor or Author section in the head of the document? </span>
+    
+      <xsl:choose>
+        <xsl:when test="normalize-space($editors_section)">
+          <span class="yes">OK</span> 
+          (<xsl:call-template name="trd:getEditorsList"/>)
+        </xsl:when>
+        <xsl:otherwise>
+          <span class="no">Error</span> 
+          (no &lt;dt&gt; elements begining by 'Author' or 'Editor' found)
+        </xsl:otherwise>
+      </xsl:choose>
+    
+  </xsl:template>
+
+<!-- Check if there is a link to errata -->
+  <xsl:template name="errataTest">
+    <xsl:variable name="errata">
+      <xsl:call-template name="trd:getErrata"/>
+    </xsl:variable>
+    <span class="test">Is there a link to the errata after the authors and before the copyright? </span>
+    
+      <xsl:choose>
+        <xsl:when test="normalize-space($errata)">
+          <span class="yes">OK</span>
+        </xsl:when>
+        <xsl:otherwise>
+          <span class="no">Error</span> (did not find a link labeled
+	  "errata" in the first paragraph after the authors).
+        </xsl:otherwise>
+      </xsl:choose>
+    
+  </xsl:template>
+
+<!-- Check if there is a link to translations -->
+  <xsl:template name="translationTest">
+    <xsl:variable name="translations">
+      <xsl:call-template name="trd:getTranslations"/>
+    </xsl:variable>
+    <span class="test">Is there a link to the translations after the authors and before the copyright? </span>
+    
+      <xsl:choose>
+        <xsl:when test="normalize-space($translations)">
+          <span class="yes">OK</span>
+        </xsl:when>
+        <xsl:otherwise>
+          <span class="no">Error</span> Link to translations not found.
+        </xsl:otherwise>
+      </xsl:choose>
+    
+  </xsl:template>
+
+<!-- Check if the copyright is good - Having problem when docs use © or &#169; instead of &#xa9; (same for registered character) -->
+  <xsl:template name="copyrightTest">
+    <xsl:param name="boilerplate"/>
+    <xsl:variable name="doccopyright" select="/html:html/html:body//html:p[contains(@class,'copyright')]"/>
+    <!-- For consideration: an additional text looking for the word "copyright"
+    or the (c) character in the head, but not in a paragraph with @class='copyright' -->
+    <xsl:choose>
+      <xsl:when test="count($doccopyright) &gt; 1">
+	<span class="no">Error</span>. More than one copyright statement found; please merge into a single statement.
+      </xsl:when>
+      <xsl:when test="normalize-space($doccopyright)=''">
+	<span class="no">Error</span>. No copyright paragraph located.
+      </xsl:when>
+
+      <xsl:when test="replace(normalize-space(translate($doccopyright,'&#xA0;',' ')),'Copyright\s&#169;\s?[21][09]\d\d(\s*[,\-]\s*\d\d\d\d)*\sW3C\s?&#174;\s?',concat('Copyright &#169; ',$year,' W3C&#174; '))=normalize-space($boilerplate)">
+	<!-- Text of copyright ok; check markup -->
+	<xsl:variable name="boilerplateabbr">
+	  <xsl:apply-templates select="$boilerplate" mode="acrotoabbr"/>
+	</xsl:variable>
+	<xsl:choose>
+	  <xsl:when test="deep-equal(wsn:deep-strip-text($doccopyright),wsn:deep-strip-text($boilerplate))">
+	    <span class="yes">OK (with date range <xsl:value-of select="replace(normalize-space(translate($doccopyright,'&#xA0;',' ')),'.*([21][09]\d\d(\s*[,\-]\s*\d\d\d\d)*).*','$1')"/>)</span>
+	  </xsl:when>
+	  <xsl:when test="deep-equal(wsn:deep-strip-text($doccopyright),wsn:deep-strip-text($boilerplateabbr))">
+	    <span class="yes">OK (using abbr with date range <xsl:value-of select="replace(normalize-space(translate($doccopyright,'&#xA0;',' ')),'.*([21][09]\d\d(\s*[,\-]\s*\d\d\d\d)*).*','$1')"/>)</span>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    The text seems correct but the markup differs.
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span>. 
+	Required boilerplate text not found. Hint: Are there some whitespace differences after the year? Instead found: <xsl:copy-of select="$doccopyright"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="html:acronym" mode="acrotoabbr">
+    <abbr>
+      <xsl:apply-templates select="node()|@*" mode="acrotoabbr"/>
+    </abbr>
+  </xsl:template>
+
+  <xsl:template match="node()|@*" mode="acrotoabbr">
+    <xsl:copy>
+      <xsl:apply-templates select="node()|@*" mode="acrotoabbr"/>
+    </xsl:copy>
+  </xsl:template>
+
+<!-- Check if there is a link to the W3C document notice -->
+  <xsl:template name="W3CDocNoticeTest">
+    <span class="test">Is there a link to the W3C document notice? </span><xsl:text> </xsl:text>
+    
+    <xsl:choose>
+      <xsl:when test="$trd:divHead">
+	<xsl:choose>
+	  <xsl:when test="$trd:divHead/descendant::*[local-name()='a']/@href='http://www.w3.org/Consortium/Legal/ipr-notice#Copyright'">
+	    <span class="yes">OK</span>
+	  </xsl:when>
+	  <xsl:when test="//descendant::*[local-name()='a']/@href='http://www.w3.org/Consortium/Legal/ipr-notice#Copyright'">
+	    <span class="yes">Error</span>. A link to the copyright notice
+was found, but it is not the descendent of the <code>div</code> element with <code>class="head"</code>.
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <span class="no">Error</span>. No link to the copyright notice found. 
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span> No <code>div</code> element
+	with <code>class="head"</code> found.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Check if there is a <hr/> after the copyright -->
+  <xsl:template name="hrAfterCopyrightTest">
+    <span class="test">Is there a &lt;hr/&gt; after the copyright? </span>
+    
+      <xsl:choose>
+        <xsl:when test="($trd:divHead/following-sibling::html:*[1][local-name()='hr']) or ($trd:divHead/descendant::*[position()=last()][local-name()='hr'][preceding-sibling::html:*[1][local-name()='p' and @class='copyright']])">
+          <span class="yes">OK</span>
+        </xsl:when>
+        <xsl:otherwise>
+          <span class="no">Error</span>. No proper <code>hr</code> element
+found.
+        </xsl:otherwise>
+      </xsl:choose>
+    
+  </xsl:template>
+
+<!-- Check if there is there is an abstract -->
+  <xsl:template name="abstractTest">
+    <span class="test">If there is an abstract, is it marked up by &lt;h2&gt; and is it at the right location (just after the hr)? </span>
+    
+      <xsl:choose>
+        <xsl:when test="/html:html/html:body//html:h2[normalize-space()='Abstract']">
+          <xsl:choose>
+            <xsl:when test="/html:html/html:body//html:div[@class='head']/html:hr/following::html:*[1][normalize-space()='Abstract'] or /html:html/html:body//html:div[@class='head']/following::html:hr[1]/following::html:*[not(local-name()='div')][1][normalize-space()='Abstract']">
+              <span class="yes">OK</span>
+            </xsl:when>
+            <xsl:otherwise>
+              Found Abstract in an h2 element but did not find it immediately following the hr element. <span class="tocheck">Please verify</span> 
+whether it is part of a div element or other container.
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <span class="no">Error</span>. Did not find an Abstract in an h2 element.
+        </xsl:otherwise>
+      </xsl:choose>
+     
+  </xsl:template>
+
+<!-- Check if there is a STOD setcion -->
+  <xsl:template name="sotdTest">
+    <span class="test">Is there a status of the document and is it correctly marked up? </span>
+    
+      <xsl:choose>
+        <xsl:when test="$SOTD">
+	  <xsl:choose>
+	    <xsl:when test="/html:html/html:body//html:h2[normalize-space()='Abstract'] and /html:html/html:body//html:h2[normalize-space()='Abstract']/following::html:h2[1][translate(normalize-space(.),$str:uc,$str:lc)='status of this document']">
+	      <span class='yes'>OK</span>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <span class='no'>Error</span> SOTD found, but not in the right location after the Abstract.
+	    </xsl:otherwise>
+	  </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <span class="no">Error</span> : SOTD not found (note that some tests relying on the SOTD won't be done because of this)
+        </xsl:otherwise>
+      </xsl:choose>
+  </xsl:template>
+
+<!-- Check if it has the right TR Doc boilerplate -->
+  <xsl:template name="boilerplateTRDocTest">
+    <xsl:param name="boilerplate"/>
+    <xsl:choose>
+      <xsl:when test="$SOTD">
+	<xsl:choose>
+	  <xsl:when test="contains(normalize-space(translate($TextOfSOTD,'&#xA0;',' ')),normalize-space($boilerplate))">
+	    <span class="yes">OK</span>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <span class="no">Error</span>. 
+	    Required boilerplate text not found. Hint: look for differences in whitespace or extra elements.
+	    Instead found: <xsl:copy-of select="$TextOfSOTD"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span>. 
+	Required boilerplate text not found in status section.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Check if it has the right Member Submission boilerplate -->
+  <xsl:template name="boilerplateMemberSubmTest">
+    <xsl:param name="boilerplate"/>
+    <xsl:choose>
+      <xsl:when test="$SOTD">
+	<xsl:choose>
+	  <xsl:when test="contains(normalize-space(translate($TextOfSOTD,'&#xA0;',' ')),normalize-space($boilerplate))">
+	    <span class="yes">OK</span>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <span class="no">Error</span>. 
+	    Required boilerplate text not found. 
+	    <xsl:if test="not($SOTD//html:a[normalize-space()='W3C Team Comment'])">
+	      Note in particular that no link to a W3C Team Comment
+	      was found.
+	    </xsl:if>
+	    <xsl:if test="not($SOTD//html:a[normalize-space()='Submitting Members'])">
+	      Note in particular that no link to the Member Submission (i.e.,
+              the cover page listing the Submitters and commitments)
+	      was found.
+	    </xsl:if>
+	    Instead found: <xsl:copy-of select="$TextOfSOTD"/>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span>. 
+	Required boilerplate text not found in status section.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Check if ther is a link to /TeamSubmission -->
+<xsl:template name="teamSubmLinkTest">
+  <xsl:if test="$SOTD">
+    <xsl:variable name="submuri">http://www.w3.org/TeamSubmission/</xsl:variable>
+    <xsl:variable name="teamSubmLinkInSOTD" 
+		  select="$SOTD/descendant::html:a/@href=($submuri,substring-after($submuri,'http://www.w3.org'))
+			  or (substring($submuri,string-length($submuri))='/' and 
+			  $SOTD/descendant::html:a/@href=(substring($submuri,1,string-length($submuri)-1),substring-after(substring($submuri,1,string-length($submuri)-1),'http://www.w3.org')))" as="xs:boolean"/>
+    <span class="test">Does the status section contain a link to the Team Submission page? </span>
+    <xsl:choose>
+      <xsl:when test="$teamSubmLinkInSOTD">
+	<span class="yes">OK</span>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span> (not found)
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+</xsl:template>
+
+ 
+<!-- Check if all dates are in format DD Month YYYY -->
+  <xsl:template name="datesFormatTest">
+    <xsl:if test="$SOTD">     
+      <!-- Not checked -->
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if the doc is a FPWD -->
+  <xsl:template name="FPWDTest">
+    <xsl:if test="$SOTD">
+        <xsl:choose>
+	  <xsl:when test="$isFirstPublicWorkingDraft">
+	    <xsl:variable name="docInfoAboutFPWD">
+	      <xsl:call-template name="trd:isFirstPublicWorkingDraft"/>
+	    </xsl:variable>
+	    <xsl:choose>
+	      <xsl:when test="normalize-space($docInfoAboutFPWD)">
+		<span class="yes">OK</span>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<span class="no">Error</span> 
+		(The expression "First Public Working Draft" was not found in the SOTD)
+	      </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <span class="no">Error</span> This test has been called in error, even though the user has indicated that this is not a First Public Working Draft.
+	  </xsl:otherwise>
+	</xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if the doc is a Last Call -->
+  <xsl:template name="LCTest">
+    <xsl:if test="$SOTD">
+      <xsl:choose>
+	<xsl:when test="$isLastCall">
+	  <xsl:variable name="docInfoAboutLC">
+	    <xsl:call-template name="trd:isLastCall"/>
+	  </xsl:variable>
+	  <xsl:choose>
+	    <xsl:when test="normalize-space($docInfoAboutLC)">
+	      <span class="yes">OK</span>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <span class="no">Error</span> 
+	      (The expression "Last Call" was not found in the SOTD)
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:when>
+	<xsl:otherwise>
+	  <span class="no">Error</span> This test has been called in error, even though the user has indicated that this is not a Last Call Working Draft.
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if ther is a link to to the public WG page -->
+  <xsl:template name="WGLinkTest">
+    <xsl:if test="$SOTD">
+      <span class="test">Is there a link to the Working Group home page in the status of the document? </span>
+      
+        <xsl:choose>
+          <xsl:when test="$workinggroup_uris!=''">
+            <span class="yes">OK</span> -  Found <xsl:value-of select="$workinggroup_count"/>:  <xsl:value-of select="$workinggroup_uris"/>. <strong>Note</strong>: The displayed URI may be that of the group's Member-only home
+page, even if the status section uses a link to the group's public page.
+The current checker implementation relies on code that displays the URI
+known to W3C's internal database of group home pages, even if the URI
+found in the status section is to a public page.
+          </xsl:when>
+          <xsl:otherwise>
+            <span class="no">Error</span>, no link to a Working Group page found. Note: If the Working Group has closed, the group home page may no longer
+be known to the checker even if the page itself still exists.
+          </xsl:otherwise>
+        </xsl:choose>
+      
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if ther is a link to to the public WG page -->
+  <xsl:template name="XGLinkTest">
+    <xsl:if test="$SOTD">
+      <xsl:variable name="xguris" select="document('http://www.w3.org/2005/Incubator/')//html:a[@class='xghome']"/>
+      <xsl:choose>
+	<xsl:when test="normalize-space($xguris)=''">
+           No Incubator Groups listed on <a href="http://www.w3.org/2005/Incubator">W3C Incubator Activity home page</a>.
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:variable name="xglinks">
+	    <xsl:for-each select="$xguris">
+	      <xsl:value-of select="$SOTD//html:a[@href=.]"/>
+	    </xsl:for-each>
+	  </xsl:variable>
+	  <xsl:choose>
+	    <xsl:when test="normalize-space($xglinks)">
+	      <span class="yes">OK</span> (<xsl:value-of select="$xguris"/>)
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <span class="no">Error</span>, no link to an XG home page found.
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="mailingListNameTest">
+    <xsl:choose>
+      <xsl:when test="$SOTD">
+	<xsl:choose>
+          <xsl:when test="normalize-space($FeedbackInSOTD)">
+	    <xsl:choose>
+	      <xsl:when test="not(contains($FeedbackInSOTD,'@'))">
+		<span class="no">Error</span> "mailto:" URI found
+		but no "@" sign found in email address. (<xsl:value-of select="$FeedbackInSOTD"/>)
+	      </xsl:when>
+	      <xsl:otherwise>
+		Address found: (<xsl:value-of select="$FeedbackInSOTD"/>)
+		Does this mailing list have a public archive?
+	      </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <span class="warning">Warning</span>
+	    No mailing list identified with a "mailto:" URI.
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span> No status section found.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="mailingListLinkTest">
+    <xsl:choose>
+      <xsl:when test="$SOTD">
+	<xsl:choose>
+          <xsl:when test="normalize-space($MLArchivesInSOTD)">
+	    Found: (<xsl:value-of select="$MLArchivesInSOTD"/>) Is
+	    this a link to the archive of the identified mailing
+	    list?
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <span class="no">Error</span> 
+	    No link to public mailing list archive found.
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span> No status section found.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+      
+<!-- Check if there is an email feedback link for the AC Reps to a team only mailing for PR Review -->
+  <xsl:template name="ACRepFeedbackEmailTest">
+    <xsl:if test="$SOTD">
+        <xsl:choose>
+          <!-- we check that we have found at least 2 email addresses for feedback -->
+          <xsl:when test="contains(substring-after(normalize-space($FeedbackInSOTD),'@'),'@')">
+            2 email addresses found in the status section. Check that 
+            one of <xsl:value-of select="$FeedbackInSOTD"/> is a Team-only mailing list.
+          </xsl:when>
+	  <xsl:when test="$SOTD//html:a[matches(@href,'(http://www.w3.org)?/2002/09/wbs/')]">
+	    Found a <a href="{$SOTD//html:a[matches(@href,'(http://www.w3.org)?/2002/09/wbs/')]/@href}">link to an online questionnaire</a>. Does this link provide access to the review form?
+	  </xsl:when>
+	  <xsl:otherwise>
+            <span class="no">Error</span>. Did not find information about a forum for AC Representative feedback.
+          </xsl:otherwise>
+        </xsl:choose>
+      
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if there is a mailing list for sending comments on a team subm -->
+  <xsl:template name="commentsMailingListTest">
+    <xsl:if test="$SOTD">     
+      <!-- Not checked -->
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if there is a deadline for LC review -->
+  <xsl:template name="reviewEndDateLCTest">
+    <xsl:call-template name="reviewEndDateTest" />
+  </xsl:template>
+
+<!-- Check if there is a deadline for PR/PER review -->
+  <xsl:template name="reviewEndDatePRTest">
+    <xsl:call-template name="reviewEndDateTest" />
+  </xsl:template>
+
+<!-- Check if there is a deadline for CR transition -->
+  <xsl:template name="reviewEndDateCRTest">
+    <xsl:call-template name="reviewEndDateTest" />
+  </xsl:template>
+
+<!-- Check if there is a deadline for LC/PR/PER review -->
+  <xsl:template name="reviewEndDateTest">
+    <xsl:if test="$SOTD">
+      <span class="test">Is there a deadline for feedback in the SOTD? </span>
+      
+        <xsl:choose>
+          <xsl:when test="normalize-space($FeedBackDue)">
+            <span class="yes">OK</span> (<xsl:value-of select="$FeedBackDue"/>)
+          </xsl:when>
+          <xsl:otherwise>
+            <span class="no">Error</span>, no date found in the format DD Month YYYY in the SOTD. Please check whether all dates mentioned are after
+the title page date. 
+            <xsl:comment><xsl:value-of select="$FeedBackDue"/></xsl:comment> 
+            <xsl:if test="$isLastCall">
+              (Note that the checker has been configured to indicate
+	      that this is a Last Call document.)
+            </xsl:if>
+          </xsl:otherwise>
+        </xsl:choose>
+      
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if there is a link to an interoperability or implementation report -->
+  <xsl:template name="implReportTest">
+    <xsl:if test="$SOTD">     
+      <span class="test">Does the status section contain a link to an interoperability or implementation report? </span>
+      
+        <xsl:choose>
+          <xsl:when test="normalize-space($ImplOrInteropLinkInSOTD)">
+            <span class="yes">OK</span>, candidate(s) found: <xsl:copy-of select="$ImplOrInteropLinkInSOTD"/>
+          </xsl:when>
+          <xsl:otherwise>
+            No candidate found (looking for links containing the word 'implementation' or 'interoperability'. Is another term
+used? Is there a link to a statement that no report is necessary?
+          </xsl:otherwise>
+        </xsl:choose>
+      
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if there is any "features at risk" -->
+<xsl:template name="featAtRiskTest">
+    <xsl:if test="$SOTD">
+      <!-- Not checked -->
+    </xsl:if>
+</xsl:template>
+  
+<!-- Check if it indicates its relationship to previous related Recommendations  -->
+<xsl:template name="recRelationTest">
+  <xsl:if test="$SOTD">     
+    <xsl:choose>
+      <xsl:when test="$SOTD//html:a[contains(@href,concat('REC-',$shortname))]">
+	There is a link in the status section that includes the same shortname as this document (with link text: <xsl:value-of select="$SOTD//html:a[contains(@href,concat('REC-',$shortname))]"/>). Does this link satisfy
+	the pubrules requirement?
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="warning">Warning</span>, no link found in the status section that includes the same shortname as this document (<xsl:value-of select="$shortname"/>). This suggests that there is no reference to a previous Recommendation for this
+	document. Shortnames do change.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+</xsl:template>
+
+<!-- Check if it includes or links to rationale for the decision to rescind the Recommendation -->
+  <xsl:template name="rescindDecisionTest">
+    <xsl:if test="$SOTD">
+      Is there a link to the rationale for rescinding?
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if there is a customized paragraph in sotd -->
+  <xsl:template name="customParagraphTest">
+    <xsl:if test="$SOTD">
+      <!-- Doing nothing -->
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if there is a link to changes since the previous transition -->
+  <xsl:template name="changesListTest">
+    <xsl:if test="$SOTD">
+      <!-- Doing nothing -->
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if the sotd contains the boilerplate about stability -->
+<!-- Note use of string matching here, which is sufficient for this text -->
+  <xsl:template name="stabilityTest">
+    <xsl:param name="boilerplate"/>
+    <xsl:choose>
+      <xsl:when test="contains(normalize-space(translate($TextOfSOTD,'&#xA0;',' ')),normalize-space(translate($boilerplate,'&#xA0;',' ')))">
+	<span class="yes">OK</span>
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="no">Error</span>. 
+	Required boilerplate text not found. Instead found: <xsl:copy-of select="$TextOfSOTD"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Check if there are information about under which patent policy the document was produced -->
+  <xsl:template name="patPolReqTest">
+    <xsl:param name="boilerplate"/>
+    <xsl:if test="$SOTD">
+      <xsl:choose>
+	<xsl:when test="not($boilerplate)">
+	  <span class="no">Error</span>. No boilerplate text was identified
+          but was expected for this type of document. 
+	</xsl:when>
+	<xsl:when test="trd:underCPP() and pubutils:isWorkingDraft($docstatus)">
+	  <span class="no">Error</span>. This is a request to publish
+	  a Working Draft under the CPP. As of the <a href="http://www.w3.org/2004/02/05-pp-transition">transition to the W3C Patent Policy</a>, all
+	  Working Drafts are published under the W3C Patent Policy.
+	  If this document was previously a CR or PR under the CPP
+	  and is now being published under the W3C Patent Policy,
+	  this will trigger an exclusion period. Please be sure
+	  to contact the W3C Communications Team in this case. Do
+	  not simply change the boilerplate to indicate that this
+	  document is now under the Patent Policy as that will
+	  cause significant delays later on.
+	</xsl:when>
+	<xsl:when test="contains(normalize-space(translate($TextOfSOTD,'&#xA0;',' ')),'150 days')">
+	  <!-- Note: we run this test on any document status since editors
+	       have been known to leave this paragraph around in subsequent drafts.
+	  -->
+	  <span class="no">Error</span>. Your status section still includes a paragraph about call for exclusions containing the phrase "150 days"; please remove the paragraph, which used to be required (only) for First Public Working Drafts (see the <a href="http://www.w3.org/2004/02/02-pubrules#status-wd">February 2002 version of pubrules</a>). The checker has not yet checked whether the required boilerplate is present.
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:choose>
+	    <xsl:when test="contains(normalize-space(translate($TextOfSOTD,'&#xA0;',' ')),normalize-space($boilerplate))">
+
+	      <!-- Iterate over groups listed in the status section -->
+	      <xsl:choose>
+		<xsl:when test="$workinggroup_uris!=''">
+		  <xsl:for-each select="tokenize($workinggroup_uris,',\s*')">
+		    <xsl:variable name="homeuri" select="normalize-space(.)"/>
+		    <ul>
+		      <xsl:variable name="ippConsistency">
+			<xsl:call-template name="ippConsistency">
+			  <xsl:with-param name="wghomeuri" select="$homeuri"/>
+			</xsl:call-template>
+		      </xsl:variable>
+		      <li>
+			<!-- Could also test empty $homeuri, but seems
+			like that case is covered through normalize-space -->
+			<xsl:choose> 
+			  <xsl:when test="contains($ippConsistency,'OK')">
+			    <xsl:choose>
+			      <xsl:when test="$normative='yes' and matches(normalize-space($title),'use\s+case|requirement','i')">
+				Patent policy boilerplate seems ok as well as consistency with IPP. However, this seems to be a use cases or requirements document that is marked as normative (i.e., there are patent policy commitments). In general use cases or requirements documents are treated as informative. Please verify this is intentional. The status text may be missing the necessary text to indicate that document is informative-only; test that via the checker user interface.
+			      </xsl:when>
+			      <xsl:otherwise>
+				<span class="yes">OK</span> for the group identified by <xsl:value-of select="$homeuri"/> including consistency with IPP.
+			      </xsl:otherwise>
+			    </xsl:choose>
+			  </xsl:when>
+			  <xsl:when test="contains($ippConsistency,'Error')">
+			    <span class="no">Error</span>. Although the
+			    boilerplate text is correct, there is an
+			    inconsistency with respect to IPP
+			    for the group identified by
+			    <xsl:value-of select="$homeuri"/>:
+			    <xsl:copy-of select="$ippConsistency"/>
+			  </xsl:when>
+			  <xsl:otherwise>
+			    Although the 
+			    boilerplate text is correct, the checker is unable
+			    to determine consistency with IPP automatically
+			    for the group identified by
+			    <xsl:value-of select="$homeuri"/>:
+			    <xsl:copy-of select="$ippConsistency"/>
+			  </xsl:otherwise>
+			</xsl:choose>
+		      </li>
+		    </ul>
+		  </xsl:for-each>
+		</xsl:when>
+		<xsl:otherwise>
+		  <span class="no">Error</span> Although the boilerplate
+		  text is correct, no Working Group home page was
+		  identified, so consistency with IPP cannot be determined.
+		</xsl:otherwise>
+	      </xsl:choose>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <span class="no">Error</span>. Required boilerplate text not found. 
+	      <xsl:if test="$normative='yes' and matches(normalize-space($title),'use\s+case|requirement','i')">
+		Furthermore, the document title suggests this is a use cases or requirements document that is marked as normative (i.e., there are patent policy commitments). In general use cases or requirements documents are treated as informative. Please verify this is intentional. The status text may be missing the necessary text to indicate that document is informative-only; test that via the checker user interface.
+	      </xsl:if>
+	      <!-- Repeat this test here to catch case of missing disclosure
+	      link even when non-std boilerplate authorized -->
+	      <xsl:if test="$patpol='w3c' and not($SOTD//html:a[contains(normalize-space(@href),'/2004/01/pp-impl/')])">Furthermore, 
+		there does not seem to be
+		a link to an <a href="http://www.w3.org/2004/01/pp-impl/">IPP</a> 
+		status page for disclosures. Please ensure that the 
+		disclosures link is to an IPP status page.
+		<strong>Note:</strong> It is a current limitation of the
+		pubrules checker that it cannot determine automatically
+		whether a document is published by one or more groups.
+		If the group identified by the URI above is not jointly
+		publishing the draft, please ignore this error.
+	      </xsl:if>
+	      Found this boilerplate: <xsl:copy-of select="$TextOfSOTD"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+ <xsl:template name="ippConsistency">
+   <xsl:param name="wghomeuri"/>
+   <xsl:variable name="wgIpp" select="normalize-space(document('http://www.w3.org/2004/01/pp-impl/')/html:html/html:body//html:ol/html:li[html:a/@href=$wghomeuri]/html:a[2]/@href)"/>
+   <xsl:variable name="wgippuri" select="concat('http://www.w3.org/2004/01/pp-impl/',$wgIpp)"/>
+   <xsl:choose>
+     <xsl:when test="normalize-space($wgIpp)!=''"> <!-- WG is in IPP -->
+       <xsl:choose>
+	 <!-- Note: once fixed, the checker may detect other errors -->
+	 <xsl:when test="not($SOTD//html:a[contains(normalize-space(@href),$wgIpp)])">
+	   <span class="no">Error.</span> There does not seem to be
+	   a link from the status section to the IPP disclosures page 
+	   for this group: &lt;<a href="{$wgippuri}"><xsl:value-of select="$wgippuri"/></a>&gt;.
+	   <xsl:variable name="someotherlink" select="$SOTD//html:a[contains(normalize-space(@href),'/2004/01/pp-impl/')]/@href"/>
+	   <xsl:if test="$someotherlink!=''">
+	     There is a link to IPP, so perhaps it is to the wrong
+	     group disclosure page; the link is
+	     &lt;<a href="{$someotherlink}"><xsl:value-of select="$someotherlink"/></a>&gt;.
+	   </xsl:if>
+		<strong>Note:</strong> It is a current limitation of the
+		pubrules checker that it cannot determine automatically
+		whether a document is published by one or more groups.
+		If the group identified by the URI above is not jointly
+		publishing the draft, please ignore this error.
+	 </xsl:when>
+	 <xsl:when test="$SOTD//html:a[contains(normalize-space(@href),$wgIpp) and not(matches(normalize-space(.),'public\s+list\s+of\s+any\s+patent\s+disclosures'))]">
+	   <span class="no">Error.</span> The link to the public disclosures page does not have the right link text; please refer to boilerplate.
+	 </xsl:when>
+	 <xsl:otherwise>
+	   <xsl:variable name="specInfo" select="document($wgippuri)/html:html/html:body//html:table[1]//html:tr[descendant::html:a[@href=$latest_version]]"/>
+	   <xsl:choose>
+	     <xsl:when test="$specInfo=''"> <!-- Spec not known to IPP -->
+	       <xsl:choose>
+		 <xsl:when test="$isFirstPublicWorkingDraft">
+		   The group is in IPP,
+		   the specification is not known to IPP, and this document
+		   is identified as a First Public Working Draft.
+		 </xsl:when>
+		 <xsl:when test="$patpol='w3c' and $normative='yes'">
+		   <span class="no">Error.</span> The group is in IPP,
+		   this document is not known to IPP but is identified
+		   as being under the W3C Patent Policy with licensing 
+		   obligations. 
+		 </xsl:when>
+		 <xsl:when test="$patpol='w3c' and $normative='no'">
+		   <span class="yes">OK.</span> The group is in IPP,
+		   this document is not known to IPP but is identified
+		   as being under the W3C Patent Policy without licensing 
+		   obligations. 
+		 </xsl:when>
+		 <xsl:otherwise>  <!-- assumes normative only has yes|no val -->
+		   The group is in IPP,
+		   this document is not known to IPP and is not under
+		   the W3C Patent Policy.
+		 </xsl:otherwise>
+	       </xsl:choose>
+	     </xsl:when>
+	     <xsl:otherwise>             <!-- Spec is known to IPP -->
+	       <xsl:choose>
+		 <xsl:when test="contains($specInfo,'CPP')"> <!-- IPP says CPP -->
+		   <xsl:choose>
+		     <xsl:when test="$patpol='cpp'">
+		       <span class="yes">OK.</span> The group is in IPP and
+		       identifies this document as being governed by the CPP.
+		     </xsl:when>
+		     <xsl:otherwise>
+		       <span class="no">Error.</span> The group is in
+		       IPP. There is an inconsistency between the checker
+		       configuration (not CPP) and what IPP believes (CPP).
+		     </xsl:otherwise>
+		   </xsl:choose>
+		 </xsl:when>
+		 <xsl:otherwise> <!-- IPP says W3C Patent Policy -->
+		   <xsl:choose>
+		     <xsl:when test="$patpol='w3c'">
+		       <span class="yes">OK.</span> The group is in IPP and
+		       identifies this document as being governed by the W3C
+		       Patent Policy.
+		     </xsl:when>
+		     <xsl:otherwise>
+		       <span class="no">Error.</span> The group is in
+		       IPP. There is an inconsistency between the checker
+		       configuration (not W3C Patent Policy) 
+		       and what IPP believes (W3C Patent Policy).
+		     </xsl:otherwise>
+		   </xsl:choose>
+		 </xsl:otherwise>
+	       </xsl:choose>
+	     </xsl:otherwise>
+	   </xsl:choose>
+	 </xsl:otherwise>
+       </xsl:choose>
+     </xsl:when>
+     <xsl:otherwise>                 <!-- Group is not in IPP -->
+       <xsl:choose>
+	 <xsl:when test="$patpol='w3c'">
+	   <span class="no">Error.</span>
+	   The group is not known to IPP but is indicated
+	   as being under the W3C Patent Policy. This may indicate
+	   that the document status text is inconsistent
+	   with the patent policy for the group, that the
+	   group has not been added to IPP, or that the URI for
+	   the group home page in the status section differs
+	   from the one known to IPP.
+	 </xsl:when>
+	 <xsl:otherwise>
+	   The group is not known
+	   to IPP and therefore checker cannot automatically
+	   verify consistency of checker configuration with
+	   patent policy status.
+	 </xsl:otherwise>
+       </xsl:choose>
+     </xsl:otherwise>
+   </xsl:choose>
+ </xsl:template>
+
+<!-- Check if it indicates the number of known disclosures at the time of publication -->
+  <xsl:template name="knownDisclosureNumberTest">
+    <xsl:if test="$SOTD">
+      <!-- Not checked -->
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if there is a table of content -->
+  <xsl:template name="tocTest">
+    <xsl:choose>
+      <xsl:when test="//html:h2[normalize-space()='Table of Contents']">
+        <span class="yes">OK</span>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="warning">Warning</span> (did not find an h2 with text "Table of Contents").
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Look for one of:
+     - an h* with an @id or @name
+     - if no @id or @name on h*, then either:
+       - parent div with @id or @name or 
+       - descendent with@id or @name
+-->
+     
+  <xsl:template name="headingWithoutIDTest">
+    <xsl:variable name="headings"
+		  select="//(html:h1[preceding::html:h1],
+			    html:h2[not(matches(normalize-space(.),'status of this document|abstract','i') or normalize-space(.)=$title or normalize-space(.)=normalize-space(trd:getStatusSubtitle()))],
+			    html:h3, html:h4, html:h5, html:h6)"/>
+    <xsl:variable name="badh" select="$headings[not(@id or @name)]"/>
+    <!-- Look for either no div parent or when there is a div
+         parent, look to see whether h* is first child and
+         div has no id or name. We are not interested in shared
+	 div/@id among N heading children.
+	 -->
+    <xsl:variable name="nodiv" select="$badh[parent::html:div[not(@id or @name)] or (parent::html:div[@id or @name] and preceding-sibling::html:*) or not(parent::html:div)]"/>
+    <xsl:variable name="noprevsib" select="$nodiv[not(preceding-sibling::html:*[1][local-name()='a'][@id or @name])]"/>
+    <xsl:variable name="nokids" select="$noprevsib[not(descendant::*[@id or @name])]"/>
+    <xsl:choose>
+      <xsl:when test="$nokids">
+	<span class="no">Error</span>, heading(s) found without a target
+	anchor (specified using one of the allowed techniques):
+	<xsl:for-each select="$nokids">
+	  <br/>
+	  <xsl:value-of select="local-name(.)"/>: <xsl:value-of select="." />
+	</xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="yes">OK</span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Check if there is any broken link -->
+  <xsl:template name="brokenLinkTest">
+    <span class="tool">
+    <a
+    href="http://validator.w3.org/checklink?uri={$doc_uri}&amp;recursive=on"
+    title="Checking recursively for broken links in {$doc_uri}">Link
+    Checker</a></span>
+  </xsl:template>
+
+<!-- Check if the doc is CSS valide -->
+  <xsl:template name="cssValideTest">
+    <xsl:choose>
+      <xsl:when test="contains($CSSValidity,'OK')">
+        <span class="yes">OK</span>
+	The <a href="http://jigsaw.w3.org/css-validator/">W3C CSS Validation Service</a> 
+        was used for the <span class="tool"><a
+	href="http://jigsaw.w3.org/css-validator/validator?uri={$doc_uri}">validation
+	of this document</a></span>.
+      </xsl:when>
+      <xsl:otherwise>
+        <span class="no">Error</span>
+	The <a href="http://jigsaw.w3.org/css-validator/">W3C CSS Validation Service</a> 
+        was used for the <span class="tool"><a
+	href="http://jigsaw.w3.org/css-validator/validator?uri={$doc_uri}">validation
+	of this document</a></span>.
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Check if all visible URIs are valide -->
+  <xsl:template name="namespacesTest">
+    <xsl:choose>
+      <xsl:when test="normalize-space($nscheckmanual)!=''">
+	the
+	<span class="tool">
+	  <a href="http://cgi.w3.org/cgi-bin/nschecker?uri={$doc_uri}">Namespaces Checker</a>
+	  </span>.
+	  <strong>Note:</strong> You have selected "check namespaces
+	  manually" in the user interface.
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:variable name="ns_result"
+	select="document(concat('http://cgi.w3.org/cgi-bin/nschecker?uri=', encode-for-uri($doc_uri)))"/>
+	<xsl:choose>
+	  <xsl:when test="$ns_result//html:dd[html:span[1][@class!='yes']]">
+	    <span class="no">Error</span>
+	    The 
+	    <span class="tool">
+	      <a href="http://cgi.w3.org/cgi-bin/nschecker?uri={$doc_uri}">Namespaces Checker</a>
+	    </span>
+	    was used for this test. The following is a list
+	    of URIs that <em>might</em> be (broken) namespace URIs. 
+	    Note: If they
+	    are not namespace URIs, please just let the Webmaster know
+	    in your publication request.
+	    <dl>
+	      <xsl:for-each select="$ns_result//html:dd[html:span[@class='no']]">
+		<xsl:copy-of select="preceding-sibling::*[1]"/>
+		<xsl:copy-of select="."/>
+	      </xsl:for-each>
+	    </dl>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <span class="yes">OK</span>
+	    The 
+	    <span class="tool">
+	      <a href="http://cgi.w3.org/cgi-bin/nschecker?uri={$doc_uri}">Namespaces Checker</a>
+	    </span>
+	    was used for this test.
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Check if it conforms to the Web Content Accessibility Guidelines 1.0 -->
+  <xsl:template name="wcagTest">
+    <span class="tool"><a href="http://www.w3.org/WAI/ER/existingtools.html">Accessibility Evaluation and Repair Services</a></span>
+  </xsl:template>
+
+<!-- Check if all the files are under the publication directory  -->
+  <xsl:template name="compoundFilesLocationTest">
+    <xsl:call-template name="externalResourcesTest"/>
+  </xsl:template>
+
+  <xsl:template name='externalResourcesTest'>
+    <xsl:variable name='bad_links'>
+      <xsl:for-each select='//html:link[@rel="stylesheet"]/@href,//html:img/@src,//html:object/@data,//html:iframe/@src,//html:script/@src'>
+	<xsl:variable name="abs_uri" select="resolve-uri(normalize-space(.),$doc_uri)"/>
+	<xsl:if test="not(matches($abs_uri,'^http://www.w3.org/(TR/|Submission/|StyleSheets/TR/|(WWW/)?Icons/)'))">
+	  <a href='{.}'><xsl:value-of select='.'/></a>
+	</xsl:if>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:if test='$bad_links/html:a'>
+      <span class='no'>Error</span>. While I did not check that all resources are located in the correct directory, I did find some problematic URIs (e.g., they refer to resources not hosted by W3C or to style sheets or icons expected in other directories):
+      <ul>
+	<xsl:for-each select='$bad_links/html:a'>
+	  <li><xsl:copy-of select='.'/></li>
+	</xsl:for-each>
+      </ul>
+    </xsl:if>
+  </xsl:template>
+
+<!-- Check if the main file is called Overview.html -->
+  <xsl:template name="compoundOverviewTest">
+    <xsl:variable name="overview_from_doc">
+      <xsl:choose>
+	<xsl:when test="substring(normalize-space($this_version), string-length(normalize-space($this_version)))='/'">
+	  <xsl:value-of select="$this_version"/>Overview.html
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="$this_version"/>/Overview.html
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="overview_from_doc_uri">
+      <xsl:choose>
+	<xsl:when test="contains($doc_uri,'Overview')">
+	  <xsl:value-of select="$doc_uri"/>
+	</xsl:when>
+	<xsl:when test="substring(normalize-space($doc_uri), string-length(normalize-space($doc_uri)))='/'">
+	  <xsl:value-of select="$doc_uri"/>Overview.html
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="$doc_uri"/>/Overview.html
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="doc_uri_res">
+      <xsl:call-template name="http:get-status-code">
+	<xsl:with-param name="doc_uri" select="normalize-space($overview_from_doc_uri)"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="contains($doc_uri_res,'200')">
+	<span class="yes">OK</span>,
+	using the URI provided to the checker. Found &lt;<xsl:value-of select="$overview_from_doc_uri"/>&gt;
+	<xsl:if test="normalize-space($overview_from_doc)!=normalize-space($overview_from_doc_uri)">
+	  <xsl:variable name="doc_res">
+	    <xsl:call-template name="http:get-status-code">
+	      <xsl:with-param name="doc_uri" select="normalize-space($overview_from_doc)"/>
+	    </xsl:call-template>
+	  </xsl:variable>
+	  <xsl:choose>
+	    <xsl:when test="contains($doc_res,'200')"/>
+	    <xsl:otherwise>
+	      <strong>Note:</strong> No "Overview.html"
+	      was found using the "this version" URI, however.
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:if>
+      </xsl:when>
+      <xsl:when test="contains($doc_uri_res,'401')">
+	<span class="warning">Warning</span>, access denied.
+	<strong>Note:</strong> The current tool does not
+	take into account the proxy authentication setting in the user
+	interface when looking at HTTP response codes.
+      </xsl:when>
+      <xsl:when test="contains($doc_uri_res,'404')">
+	<span class="warning">Warning</span>, document not found.
+      </xsl:when>
+      <xsl:otherwise>
+	<span class="warning">Warning</span>, 
+	HTTP status = '<xsl:value-of select="$doc_uri_res"/>'
+	using the URI provided to the checker: &lt;<xsl:value-of select="$overview_from_doc_uri"/>&gt;
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- Check if all the files are under one directory and that all other files are reachable by links from the document  -->
+  <xsl:template name="compoundTest">
+    <xsl:variable name="linkList">
+      <xsl:call-template name="makeUnique">
+	<xsl:with-param name="list">
+	  <!-- Grab all links and sort by href -->
+	  <xsl:for-each select="/html:html/html:body//html:a[@href]">
+	    <xsl:sort select="normalize-space(@href)"/>
+	    <!-- Make them abolute uris -->
+	    <xsl:variable name="abs_uri">
+	      <xsl:call-template name="uri:expand">
+		<xsl:with-param name="base" select="$doc_uri" />
+		<xsl:with-param name="there" select="normalize-space(@href)"/>
+	      </xsl:call-template>
+	    </xsl:variable>
+	    
+	    <!-- If in same directory than doc we keep it and remove anchor -->
+	    <xsl:if test="substring-after($abs_uri,$doc_uri)">
+	      <xsl:variable name="page_uri">
+		<xsl:call-template name="str:keep-before">
+		  <xsl:with-param name="string" select="normalize-space($abs_uri)"/>
+		  <xsl:with-param name="delimiter">#</xsl:with-param>
+		</xsl:call-template>
+	      </xsl:variable>
+	      
+	      <!-- If not the doc itself add URI to list -->
+	      <xsl:if test="not($page_uri=$doc_uri)">
+		<a href="{$page_uri}"><xsl:value-of select="$page_uri"/></a><br />
+	      </xsl:if>
+	      
+	    </xsl:if>
+	  </xsl:for-each>
+	</xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+    
+    <xsl:choose>
+      <xsl:when test="count($linkList//html:a) = 0">
+	<span class="warning">Warning</span> No links found to
+	additional components of a multipart document.
+      </xsl:when>
+      <xsl:otherwise>
+	For your convenience, 
+	this is the list of files linked from the main document
+	that seem to be part of a multipart document. Please verify
+	whether it is complete.
+	<xsl:if test="$recursive!='on'">
+	  <strong>Note:</strong> Because you have not selected
+	  <a href="#checker">"HTML and CSS recursive check"</a>
+	  the checks below have not been run automatically. You
+	  may run the tests manually via the links below.
+	</xsl:if>
+	<!-- 
+	     Note: We used to do "HEAD" to determine whether HTML/XHTML
+	     and then GET to get the title of those documents, but that
+	     was leading to timeouts when there was a large number
+	     of linked documents. Now, in non recursive mode we
+	     do no checking on linked documents and use file name
+	     instead of title.
+	-->
+	<xsl:variable name="rows">
+	  <xsl:for-each select="$linkList//html:a">
+	    <xsl:variable name="uri" select="@href"/>
+	    <xsl:variable name="filename" select="substring-after($uri,$doc_uri)"/>
+	    <xsl:variable name="ishtml">
+	      <xsl:if test="$recursive='on'">
+		<xsl:value-of select="pub-tests:ishtml($uri)"/>
+	      </xsl:if>
+	    </xsl:variable>
+	    <tr>
+	      <td>
+		<a href="{$uri}">
+		  <xsl:value-of select="$filename"/>
+		</a>
+	      </td>
+	      <td>
+		<xsl:choose>
+		  <xsl:when test="$recursive!='on'">
+		    <span class="tocheck">
+		      <a title="HTML Validation for {$uri}" href="http://validator.w3.org/check?uri={$uri}">HTML validator</a>
+		    </span>
+		  </xsl:when>
+		  <xsl:when test="not($ishtml)">
+		    N/A
+		  </xsl:when>
+		  <xsl:otherwise>
+		    <xsl:variable name="HTMLValidity-dep">
+		      <xsl:call-template name="vld:is-html-valid">
+			<xsl:with-param name="doc_uri" select="$uri"/>
+		      </xsl:call-template>
+		    </xsl:variable>
+		    <xsl:variable name="HTMLValidity-dep-class">
+		      <xsl:if test="$HTMLValidity-dep='OK'">
+			yes
+		      </xsl:if>
+		      <xsl:if test="$HTMLValidity-dep='Error'">
+			no
+		      </xsl:if>
+		    </xsl:variable>
+		    <xsl:choose>
+		      <xsl:when test="normalize-space($HTMLValidity-dep)">
+			<span class="{$HTMLValidity-dep-class}"><xsl:copy-of select="$HTMLValidity-dep"/></span>
+		      </xsl:when>
+		      <xsl:otherwise>N/A</xsl:otherwise>
+		    </xsl:choose>
+		  </xsl:otherwise>
+		</xsl:choose>
+	      </td>
+	      <td>
+		<xsl:choose>
+		  <xsl:when test="$recursive!='on'">
+		    <span class="tocheck">
+		      <a title="CSS validation for {$uri}"
+			 href="http://jigsaw.w3.org/css-validator/validator?uri={$uri}">CSS validator</a>
+		    </span>
+		  </xsl:when>
+		  <xsl:when test="not($ishtml)">
+		    N/A
+		  </xsl:when>
+		  <xsl:otherwise>
+		    <xsl:variable name="CSSValidity-dep">
+		      <xsl:call-template name="vld:is-css-valid">
+			<xsl:with-param name="doc_uri" select="$uri"/>
+		      </xsl:call-template>
+		    </xsl:variable>
+		    <xsl:variable name="CSSValidity-dep-class">
+		      <xsl:if test="$CSSValidity-dep='OK'">
+			yes
+		      </xsl:if>
+		      <xsl:if test="$CSSValidity-dep='Error'">
+			no
+		      </xsl:if>
+		    </xsl:variable>
+		    <xsl:choose>
+		      <xsl:when test="normalize-space($CSSValidity-dep)">
+			<span class="{$CSSValidity-dep-class}"><xsl:copy-of select="$CSSValidity-dep"/></span>
+		      </xsl:when>
+		      <xsl:otherwise>N/A</xsl:otherwise>
+		    </xsl:choose>
+		  </xsl:otherwise>
+		</xsl:choose>
+	      </td>
+	      <td>
+		<span class="tocheck"><a href="http://cgi.w3.org/cgi-bin/nschecker?uri={$uri}">Namespaces checker</a></span>
+	      </td>
+	    </tr>
+	  </xsl:for-each>
+	</xsl:variable>
+	
+	<xsl:if test="count($rows/html:tr) &gt; 0">
+	  <table border="1">
+	    <caption>Linked Resources</caption>
+	    <thead>
+	      <tr>
+		<th>Resource</th>
+		<th>HTML validation</th>
+		<th>CSS Validation</th>
+		<th>Namespaces</th>
+	      </tr>
+	    </thead>
+	    <tbody>
+	      <xsl:copy-of select="$rows/html:tr"/>
+	    </tbody>
+	  </table>
+	</xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+<!-- This uses an XT extension to keep only unique dependent documents -->
+   <xsl:template name="makeUnique">
+    <xsl:param name="list"/>
+    <xsl:for-each select="$list//html:a">
+      <xsl:if test="not(preceding::html:a[1] = .)">
+        <xsl:copy-of select="."/>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:template>
+
+<xsl:function name="pub-tests:ishtml" as="xs:boolean">
+  <xsl:param name="uri"/>
+  <xsl:variable name="ContentType" select="pub-tests:content-type($uri)"/>
+  <xsl:choose>
+    <xsl:when test="$ContentType='text/html'">true</xsl:when>
+    <xsl:when test="$ContentType='application/xhtml+xml'">true</xsl:when>
+    <xsl:otherwise>false</xsl:otherwise>
+  </xsl:choose>
+</xsl:function>
+
+<!-- This is a modified version of http:get-content-type that
+     takes authentication into account -->
+
+<xsl:function name="pub-tests:content-type">
+  <xsl:param name="uri"/>
+  <xsl:if test="starts-with($uri,'http://')">
+    <xsl:value-of select="normalize-space(substring-before(document(concat('http://www.w3.org/services/headers?url=',$uri,'&amp;auth=on'))/html:html/html:body/html:pre/html:span[@class='headername' and .='Content-Type'][position()=last()]/following::html:span[@class='headervalue'][1],';'))"/>
+  </xsl:if>
+</xsl:function>
+
+</xsl:stylesheet>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/WWW/2005/09/checker/utils.xsl	Wed Sep 28 10:30:22 2011 -0400
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                xmlns='http://www.w3.org/1999/xhtml'
+                xmlns:html='http://www.w3.org/1999/xhtml'
+                xmlns:pubutils='http://www.w3.org/2005/09/checker/utils'
+		xmlns:date="http://www.w3.org/2001/08/date-util.xslt"
+		xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                exclude-result-prefixes="html">
+
+<xsl:import href="../../../2001/08/date-util.xslt"/>
+
+  <xsl:output
+    method="xml"
+    encoding='utf-8'
+    media-type="text/html" 
+    version="1.0" 
+    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+	      />
+
+<xsl:template name="pubutils:status-name">
+  <xsl:param name="status"/>
+  <xsl:choose>
+    <xsl:when test="contains($status,'wd-tr')">Working Draft</xsl:when>
+    <xsl:when test="contains($status,'cr-tr')">Candidate Recommendation</xsl:when>
+    <xsl:when test="contains($status,'pr-tr')">Proposed Recommendation</xsl:when>
+    <xsl:when test="contains($status,'per-tr')">Proposed Edited Recommendation</xsl:when>
+    <xsl:when test="contains($status,'rec-tr')">Recommendation</xsl:when>
+    <xsl:when test="$status='prrescind-tr'">Proposed Rescinded Recommendation</xsl:when>
+    <xsl:when test="contains($status,'rescind-tr')">Rescinded Recommendation</xsl:when>
+    <xsl:when test="$status='fpig-note-tr'">Interest Group Note</xsl:when>
+    <xsl:when test="$status='fpcg-note-tr'">Coordination Group Note</xsl:when>
+    <xsl:when test="$status='fpwg-note-tr'">Working Group Note</xsl:when>
+    <xsl:when test="contains($status,'wg-note-tr')">Working Group Note</xsl:when>
+    <xsl:when test="contains($status,'ig-note-tr')">Interest Group Note</xsl:when>
+    <xsl:when test="contains($status,'cg-note-tr')">Coordination Group Note</xsl:when>
+    <xsl:when test="contains($status,'note-tr')">Group Note</xsl:when>
+    <xsl:when test="contains($status,'team-subm')">Team Submission</xsl:when>
+    <xsl:when test="contains($status,'mem-subm')">Member Submission</xsl:when>
+    <xsl:when test="contains($status,'xgr')">Incubator Group Report</xsl:when>
+    <xsl:otherwise>UNKNOWN STATUS</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="pubutils:short-status">
+  <xsl:param name="status"/>
+  <xsl:choose>
+    <xsl:when test="contains($status,'wd-tr')">WD</xsl:when>
+    <xsl:when test="contains($status,'cr-tr')">CR</xsl:when>
+    <xsl:when test="contains($status,'pr-tr')">PR</xsl:when>
+    <xsl:when test="contains($status,'per-tr')">PER</xsl:when>
+    <xsl:when test="contains($status,'rec-tr')">REC</xsl:when>
+    <xsl:when test="contains($status,'rescind-tr')">RSCND</xsl:when>
+    <xsl:when test="contains($status,'note-tr')">NOTE</xsl:when>
+    <xsl:when test="contains($status,'subm')">SUBM</xsl:when>
+    <xsl:when test="contains($status,'xgr')">XGR</xsl:when>
+    <xsl:otherwise>UNKNOWN STATUS</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="pubutils:valid-status">
+  <xsl:param name="status"/>
+  <xsl:choose>
+    <xsl:when test="$status='fpwd-wd-tr' or
+                    $status='fpwdlc-wd-tr' or
+                    $status='lc-wd-tr' or
+                    $status='ord-wd-tr' or
+                    $status='cr-tr' or
+                    $status='pr-tr' or
+                    $status='per-tr' or
+                    $status='rec-tr' or
+                    $status='wg-note-tr' or
+                    $status='fpwg-note-tr' or
+                    $status='ig-note-tr' or
+                    $status='fpig-note-tr' or
+                    $status='cg-note-tr' or
+                    $status='fpcg-note-tr' or
+                    $status='team-subm' or
+                    $status='mem-subm' or
+                    $status='xgr' or
+                    $status='prrescind-tr' or
+                    $status='rescind-tr'
+		    ">true</xsl:when>
+    <xsl:otherwise>false</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:function name="pubutils:isWorkingDraft" as="xs:boolean">
+  <xsl:param name="docstatus"  as="xs:string"/>
+  <xsl:value-of select="matches($docstatus,'wd-tr')"/>
+</xsl:function>
+
+<xsl:function name="pubutils:isWorkingDraftButNotFirst" as="xs:boolean">
+  <xsl:param name="docstatus"  as="xs:string"/>
+  <xsl:value-of select="matches($docstatus,'wd-tr') and not(pubutils:isFirstPublicWorkingDraft($docstatus))"/>
+</xsl:function>
+
+<xsl:function name="pubutils:isLastCall" as="xs:boolean">
+  <xsl:param name="docstatus"  as="xs:string"/>
+  <xsl:value-of select="$docstatus='lc-wd-tr' or $docstatus='fpwdlc-wd-tr'"/>
+</xsl:function>
+
+<xsl:function name="pubutils:isRec" as="xs:boolean">
+  <xsl:param name="docstatus"  as="xs:string"/>
+  <xsl:value-of select="$docstatus='rec-tr'"/>
+</xsl:function>
+
+<xsl:function name="pubutils:isFirstPublicWorkingDraft" as="xs:boolean">
+  <xsl:param name="docstatus"  as="xs:string"/>
+  <xsl:value-of select="$docstatus='fpwd-wd-tr' or $docstatus='fpwdlc-wd-tr'"/>
+</xsl:function>
+
+<xsl:function name="pubutils:isSubmission" as="xs:boolean">
+  <xsl:param name="docstatus"  as="xs:string"/>
+  <xsl:value-of select="contains($docstatus,'subm')"/>
+</xsl:function>
+
+<xsl:function name="pubutils:isTeamSubmission" as="xs:boolean">
+  <xsl:param name="docstatus" as="xs:string"/>
+  <xsl:value-of select="$docstatus='team-subm'"/>
+</xsl:function>
+
+<xsl:function name="pubutils:isMemberSubmission" as="xs:boolean">
+  <xsl:param name="docstatus" as="xs:string"/>
+  <xsl:value-of select="$docstatus='mem-subm'"/>
+</xsl:function>
+
+<xsl:function name="pubutils:isNote" as="xs:boolean">
+  <xsl:param name="docstatus"  as="xs:string"/>
+  <xsl:value-of select="contains($docstatus,'note-tr')"/>
+</xsl:function>
+
+<xsl:function name="pubutils:isFirstPublicNote" as="xs:boolean">
+  <xsl:param name="docstatus"  as="xs:string"/>
+  <xsl:value-of select="$docstatus='fpig-note-tr' or 
+                        $docstatus='fpcg-note-tr' or
+			$docstatus='fpwg-note-tr'"/>
+</xsl:function>
+
+<xsl:function name="pubutils:isXGR" as="xs:boolean">
+  <xsl:param name="docstatus"  as="xs:string"/>
+  <xsl:value-of select="$docstatus='xgr'"/>
+</xsl:function>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/WWW/2005/09/checker/ws-normalize.xsl	Wed Sep 28 10:30:22 2011 -0400
@@ -0,0 +1,200 @@
+<?xml-stylesheet href="http://www.w3.org/StyleSheets/base.css" type="text/css"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns='http://www.w3.org/1999/xhtml'
+  xmlns:html='http://www.w3.org/1999/xhtml'
+  xmlns:wsn='http://www.w3.org/2005/09/checker/ws-normalize'
+  xmlns:xdt='http://www.w3.org/2005/xpath-datatypes'
+  exclude-result-prefixes="wsn html xdt xsl"
+  version="2.0">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <link rel="stylesheet" href="http://www.w3.org/StyleSheets/base"/>
+    <title>Recursive whitespace normalization</title>
+    <style type="text/css">
+      template, variable, param, tests { display: none }
+    </style>
+  </head>
+  <body>
+    <div class='head'><a href="/"><img src="/Icons/w3c_home" alt="W3C"/></a> </div>
+    <h1>Recursive whitespace normalization</h1>
+
+    <p>Determine whether two XML trees are same, having normalized
+       space recursively.</p>
+
+    <p class="copyright">Copyright &#169; 2006 <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/Jacobs/">Ian Jacobs</a> - $Id: ws-normalize.xsl,v 1.13 2007/01/02 22:23:18 ijacobs Exp $</address>
+    </body>
+</html>
+
+<tests xmlns="http://www.w3.org/2005/09/checker/ws-normalize">
+  <test>
+    <a>Same element and text</a>
+    <a>Same element and text</a>
+    <result>true</result>
+  </test>
+  <test>
+    <a>Same element      but more spaces internally   </a>
+    <a>   Same element but more spaces internally</a>
+    <result>true</result>
+  </test>
+  <test>
+    <a>One nested, the other not</a>
+    <a><b>One nested, the other not</b></a>
+    <result>false</result>
+  </test>
+  <test>
+    <a attr="1">Same element and text and attrib and value</a>
+    <a attr="1">Same element and text and attrib and value</a>
+    <result>true</result>
+  </test>
+  <test>
+    <a>Different element, same text</a>
+    <b>Different element, same text</b>
+    <result>false</result>
+  </test>
+  <test>
+    <a>Same element, different text</a>
+    <a>Different text, same element</a>
+    <result>false</result>
+  </test>
+  <test>
+    <a>Same element, different text</a>
+    <a>Same element, different text since more</a>
+    <result>false</result>
+  </test>
+  <test>
+    <a attr="1">Same element, text, same attribute names</a>
+    <a attr="1">Same element, text, same attribute names</a>
+    <result>true</result>
+  </test>
+  <test>
+    <a attr="1">Same element, text, same attribute names</a>
+    <a attr2="1">Same element, text, diff attribute names</a>
+    <result>false</result>
+  </test>
+  <test>
+    <a attr="1" attr2="1">Different number attributes</a>
+    <a attr2="1">Different number attributes</a>
+    <result>false</result>
+  </test>
+  <test>
+    <a attr="1">Different number attributes</a>
+    <a attr2="1" attr3="2">Different number attributes</a>
+    <result>false</result>
+  </test>
+  <test>
+    <a attr="1" attr2="2">Different attribute values</a>
+    <a attr="2" attr2="2">Different attribute values</a>
+    <result>false</result>
+  </test>
+  <test>
+    <a><b>Nested element</b></a>
+    <a><b>Nested element</b></a>
+    <result>true</result>
+  </test>
+  <test>
+    <a><b>Nested element wrong</b></a>
+    <a><c>Nested element wrong</c></a>
+    <result>false</result>
+  </test>
+  <test>
+    <a><b>Nested element</b></a>
+    <a><b>Nested element</b><c>Second nested</c></a>
+    <result>false</result>
+  </test>
+  <test>
+    <a><b><c>Nested three</c></b></a>
+    <a><b><c>Nested three</c></b></a>
+    <result>true</result>
+  </test>
+  <test>
+    <a><b><c>Nested three</c></b> Mixed</a>
+    <a><b><c>Nested three</c></b> Mixed</a>
+    <result>true</result>
+  </test>
+  <test>
+    <a><b><c>Nested three</c></b> Mixed</a>
+    <a><b><c>Nested three</c></b> Bad Mixed</a>
+    <result>false</result>
+  </test>
+  <test>
+    <a><b>Wrong</b><c>Order</c></a>
+    <a><c>Wrong</c><b>Order</b></a>
+    <result>false</result>
+  </test>
+  <test>
+    <a><b><c attr="1">Nested three attrib</c></b> Mixed</a>
+    <a><b><c attr="2">Nested three attrib</c></b> Mixed</a>
+    <result>false</result>
+  </test>
+  <test>
+    <a><b>B</b> Text</a>
+    <a> Text <b>B</b></a>
+    <result>false</result>
+  </test>
+  <test>
+    <a><b><c>Nested three</c><d>testing extra space before element</d></b></a>
+    <a><b><c>Nested three</c> <d>testing extra space before element</d></b></a>
+    <result>true</result>
+  </test>
+  <test>
+    <a><b></b></a>
+    <a><b> </b></a>
+    <result>true</result>
+  </test>
+</tests>
+
+<!-- For the Unit Test -->
+<xsl:template match="/">
+  <xsl:message>Starting</xsl:message>
+  <xsl:for-each select="document('')/xsl:stylesheet/wsn:tests/wsn:test">
+      <xsl:message>Running test # <xsl:value-of select="position()"/> with tree1=<xsl:value-of select="*[position()=1]"/>; tree2=<xsl:value-of select="*[position()=2]"/>.</xsl:message>
+    <xsl:variable name="output" select="deep-equal(wsn:deep-normalize-space(*[position()=1]),wsn:deep-normalize-space(*[position()=2]))"/>
+    <xsl:choose>
+      <xsl:when test="not($output=wsn:result)">
+
+        <xsl:message>** failed: got <xsl:value-of select="$output"/>, expected <xsl:value-of select="wsn:result"/></xsl:message>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message>success!</xsl:message>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:function name="wsn:deep-normalize-space">
+  <xsl:param name="node" as="node()?"/>
+  <xsl:apply-templates mode="normalize-ws" select="$node"/>
+</xsl:function>
+
+<xsl:function name="wsn:deep-strip-text">
+  <xsl:param name="node" as="node()?"/>
+  <xsl:apply-templates mode="ignore-text" select="$node"/>
+</xsl:function>
+
+<xsl:template match="text()" mode="normalize-ws">
+  <xsl:value-of select=" normalize-space(translate(.,'&#xA0;',' ')) "/>
+</xsl:template>
+
+<xsl:template match="text()" mode="ignore-text"/>
+
+<xsl:template match="*|@*" mode="normalize-ws">
+  <xsl:copy>
+    <xsl:apply-templates mode="normalize-ws" select="@*|node()"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="*|@*" mode="ignore-text">
+  <xsl:copy>
+    <xsl:apply-templates mode="ignore-text" select="@*|node()"/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
--- a/src/main/scala/Main.scala	Mon Aug 15 16:45:38 2011 -0400
+++ b/src/main/scala/Main.scala	Wed Sep 28 10:30:22 2011 -0400
@@ -8,10 +8,9 @@
 
 import net.sf.saxon.s9api._
 import javax.xml.transform.stream.StreamSource
-import java.io._
+import java.io.{Console => _, _}
 import java.net._
 
-
 /*
  * - tests
  * - corriger url de base
@@ -66,7 +65,7 @@
 
     args.toList match {
       case dir :: _ => ResponseCache.setDefault(URLResolver(dir))
-      case _        => ()
+      case _        => Console.err.println("You must provide a path for the URLResolver"); System.exit(1)
     }
 
     val echo = unfiltered.filter.Planify {
--- a/src/main/scala/URLResolver.scala	Mon Aug 15 16:45:38 2011 -0400
+++ b/src/main/scala/URLResolver.scala	Wed Sep 28 10:30:22 2011 -0400
@@ -9,8 +9,7 @@
 import java.io._
 import java.util.jar._
 import scala.collection.JavaConversions._
-import scala.io.Source
-
+// import scala.io.Source
 
 case class CachedResponse(in:InputStream) extends CacheResponse {
   def getBody() = in
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.