<?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"?>
<xsl:stylesheet 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"
xmlns:vld="http://www.w3.org/2001/11/is-valid.xsl"
xmlns:http="http://www.w3.org/2001/11/http-head.xsl"
exclude-result-prefixes="html vld http uri">
<xsl:output method="html" media-type="text/html"
doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" indent="yes"/>
<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" />

  <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 Stylesheet to get summarized info on a W3C resource
    </h1>

    <h2>How to use it</h2>
	<p>
      <form method="GET" action="http://www.w3.org/2000/06/webdata/xslt">
	<label>URI of the XML file to check: <input type="text" name="xmlfile" /></label> (use <a href="http://cgi.w3.org/cgi-bin/tidy?docAddr=">tidy</a> if you want to check HTML 4.x)<br />
	<input type="hidden" name="xslfile" value="http://www.w3.org/2001/11/meta-profile.xsl"/>
	<input type="hidden" name="auth" value="proxy" />
	<input type="submit" value="Get results"/>
      </form></p>
    <h2>References</h2>
    <ul>
	<li><a href="/2001/10/xslt-toolbox.html">the XSLT Toolbox</a></li>
    </ul>

    <hr />

    <address>$Id: meta-profile.xsl,v 1.58 2002/02/14 20:03:40 dom Exp $
    <br />

    <a href="../../People/Dom/">Dominique Hazael-Massieux</a></address><hr/>
</div>
<xsl:param name="xmlfile"/>
<xsl:param name="debug">0</xsl:param>
<xsl:variable name="doc_uri"><xsl:choose><xsl:when test="starts-with($xmlfile,'http://cgi.w3.org/cgi-bin/tidy?docAddr=')"><xsl:value-of select="substring-after($xmlfile,'http://cgi.w3.org/cgi-bin/tidy?docAddr=')"/></xsl:when><xsl:otherwise><xsl:value-of select="$xmlfile"/></xsl:otherwise></xsl:choose></xsl:variable>
<xsl:template match="/">
  <xsl:variable name="title"><xsl:choose><xsl:when test="/html:html/html:head/html:title"><xsl:value-of select="/html:html/html:head/html:title"/></xsl:when><xsl:otherwise><xsl:value-of select="$doc_uri"/></xsl:otherwise></xsl:choose></xsl:variable>
  <xsl:variable name="content-type"><xsl:call-template name="http:get-content-type"><xsl:with-param name="doc_uri" select="$doc_uri"/><xsl:with-param name="with-param">no</xsl:with-param></xsl:call-template></xsl:variable>
  <xsl:variable name="auth-realm">
    <xsl:call-template name="http:get-header">
      <xsl:with-param name="doc_uri" select="$doc_uri"/><xsl:with-param name="header_name"><xsl:text>Www-Authenticate</xsl:text></xsl:with-param>
    </xsl:call-template>
  </xsl:variable>
  <html>
    <head><title>House style review of "<xsl:value-of select="$title"/>"</title>
	<link rel="stylesheet" href="/Stylesheets/base" />
	<link rel="stylesheet" href="/2001/11/results" type="text/css" />
</head>
    <body>
<h1>    <a href="http://www.w3.org/">
      <img src="http://www.w3.org/Icons/w3c_home" alt="W3C" />
    </a>House style review of "<a><xsl:attribute name="href"><xsl:value-of select="$doc_uri"/></xsl:attribute><xsl:value-of select="$title"/></a>"</h1>
<h2>Metadata</h2>
<p><xsl:choose><xsl:when test="normalize-space($content-type)='text/html'">This document is a <a href="/MarkUp/">HTML</a> document.</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="normalize-space($content-type)='text/xml' or normalize-space($content-type)='application/xml'">This document is a <a href="/XML/">XML</a> document, whose main namespace is <a><xsl:attribute name="href"><xsl:value-of select="namespace-uri(/*[1])"/></xsl:attribute><xsl:value-of select="namespace-uri(/*[1])"/></a>.</xsl:when><xsl:otherwise>This document has the mime-type <xsl:value-of select="$content-type"/></xsl:otherwise></xsl:choose></xsl:otherwise></xsl:choose>. The <a><xsl:attribute name="href"><xsl:value-of select="concat('http://cgi.w3.org/cgi-bin/headers?url=',$doc_uri)"/></xsl:attribute>full headers sent for this resource</a> are available online.</p>
<xsl:if test="$debug"><xsl:comment><xsl:value-of select="$doc_uri"/> <xsl:value-of select="$content-type"/></xsl:comment></xsl:if>
<xsl:choose>
  <xsl:when test="substring-after(normalize-space($auth-realm),'Basic realm=&quot;')='W3CACL&quot;'">
    <p>The access rights on it are <strong><a href="{concat($doc_uri,',access')}"><xsl:value-of select="document(concat($doc_uri,',access'))/html:html/html:body/html:form/html:table[2]/html:tr/html:td[5]"/></a></strong>.</p>    
  </xsl:when>
  <xsl:otherwise>
    <p>The access realm on it is <strong><xsl:value-of select="$auth-realm"/></strong>.</p>
  </xsl:otherwise>
</xsl:choose>

<xsl:if test="normalize-space($content-type)='text/html'">
<h2>Validity</h2>


<p>This document is served as a HTML document.
<xsl:variable name="HTMLValidity"><xsl:call-template name="vld:is-html-valid"><xsl:with-param name="doc_uri" select="$doc_uri"/></xsl:call-template></xsl:variable>
It <span><xsl:attribute name="class"><xsl:value-of select="$HTMLValidity"/></xsl:attribute><xsl:choose><xsl:when test="normalize-space($HTMLValidity)='yes'">is valid</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="normalize-space($HTMLValidity)='no'">is not valid</xsl:when><xsl:otherwise>is not validable</xsl:otherwise></xsl:choose></xsl:otherwise></xsl:choose></span></p>

<xsl:if test=".//html:img">
<p>To help checking its accessibility, you can check if the following images have appropriate alternative texts:</p>
<ul>
<xsl:for-each select=".//html:img">
<li><img><xsl:attribute name="src"><xsl:call-template name="uri:expand"><xsl:with-param name="base" select="$doc_uri"/><xsl:with-param name="there" select="@src"/></xsl:call-template></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="@alt"/></xsl:attribute></img> -> alt: <xsl:value-of select="@alt"/></li>
</xsl:for-each>
</ul></xsl:if>
<xsl:if test="starts-with($doc_uri,'http://www.w3.org')">
<h2>Navigability</h2>
<p>This document is on the W3C web site. To help people navigating through it, some simple formatting can help.</p>
<xsl:choose>
  <xsl:when test=".//html:img[contains(@src,'/Icons/w3c_home') or contains(@src,'/Icons/WWW/w3c_home')]">
    <xsl:variable name="link">
      <xsl:call-template name="uri:expand">
        <xsl:with-param name="base" select="$doc_uri"/>
        <xsl:with-param name="there" select=".//html:img[contains(@src,'/Icons/w3c_home') or contains(@src,'/Icons/WWW/w3c_home')]/parent::html:a/@href"/>
      </xsl:call-template>
    </xsl:variable>
<p>This page <span class="yes">has the W3C logo</span>
<xsl:choose>
      <xsl:when test="normalize-space($link)='http://www.w3.org/'">
        with the <span class="yes">correct</span> link found on it
      </xsl:when>
      <xsl:otherwise>
        with an <span class="no">incorrect</span> or without link found on it
      </xsl:otherwise>
    </xsl:choose></p>
  </xsl:when>
  <xsl:otherwise><p>This page <span class="no">doesn't have a W3C logo</span>. Such a logo adds consistency and allows to go quickly to the home page when the appropriate link is set.</p></xsl:otherwise>
</xsl:choose>
<p>Besides, the document <xsl:choose><xsl:when test=".//html:address"><span class="yes">has an <code>address</code> tag</span>, <xsl:choose><xsl:when test=".//html:address//html:a">with a link in it</xsl:when><xsl:otherwise> but <span class="no">without link</span> in it [useful for contact/feedback].</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><span class="no">doesn't have an <code>address</code> tag</span>. It's useful to have an address tag with informations about the author and a way to provide feedback.</xsl:otherwise></xsl:choose>.</p>
<p><xsl:choose>
  <xsl:when test=".//html:link[@rel='stylesheet']">The document <span class="yes">uses an external stylesheet</span> which is good. Make sure it's <a href="/StyleSheets/">the appropriate one</a>.</xsl:when>
  <xsl:otherwise>The document is <span class="no">not linked to any stylesheet</span> which is bad: common stylesheets are useful to provide a common look to a certain category of pages. Have a look at <a href="/StyleSheets/">the W3C Stylesheets</a> and pick the right one for the document.</xsl:otherwise></xsl:choose></p>
<xsl:choose>
  <xsl:when test="not(.//html:h1[descendant::html:a/@name or descendant::html:a/@id or parent::html:div/@id or @id]) or not(.//html:h2[descendant::html:a/@name or descendant::html:a/@id or parent::html:div/@id or @id]) or not(.//html:h3[descendant::html:a/@name or descendant::html:a/@id or parent::html:div/@id or @id]) or not(.//html:h4[descendant::html:a/@name or descendant::html:a/@id or parent::html:div/@id or @id]) or not(.//html:h5[descendant::html:a/@name or descendant::html:a/@id or parent::html:div/@id or @id]) or not(.//html:h6[descendant::html:a/@name or descendant::html:a/@id or parent::html:div/@id or @id])">
    <p>Some of the headings in the document <span class="no">don't have anchors</span> :</p><ul><xsl:for-each select=".//html:*[translate(local-name(),'123456','')='h'][not(descendant::html:a/@name or descendant::html:a/@id or parent::html:div/@id or @id)]"><li>"<xsl:value-of select="."/>"</li></xsl:for-each></ul><p>Anchors are useful to refer to some part of a document.</p>
  </xsl:when>
  <xsl:otherwise><p>The document <span class="yes">has an anchor for each heading</span>. Make sure to provide a table of content which refers to these anchors.</p></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:if>
<h2>References</h2>
<ul>
<li><a href="/Provider/Style/">Style Guide for online hypertext</a></li>
<li><a href="/Project/HouseStyle">W3C House Style</a> (Team only)</li>
<li><a href="/2001/11/meta-profile.xsl">the stylesheet used to produce this page</a></li>
<li><a href="/2001/10/xslt-toolbox">the XSLT toolbox</a></li>
</ul>
      <form method="GET" action="http://www.w3.org/2000/06/webdata/xslt">
	<p>
	<label>URI of the XML file to check: <input type="text" name="xmlfile" ><xsl:attribute name="value"><xsl:value-of select="$xmlfile"/></xsl:attribute></input></label> (use <a href="http://cgi.w3.org/cgi-bin/tidy?docAddr=">tidy</a> if you want to check HTML 4.x)<br />
	<input type="hidden" name="xslfile" value="http://www.w3.org/2001/11/meta-profile.xsl"/>
	<input type="hidden" name="auth" value="proxy" />
	<input type="submit" value="Get results"/>
</p>
      </form>
    <hr />
    <address>Produced by $Id: meta-profile.xsl,v 1.58 2002/02/14 20:03:40 dom Exp $
    <br />

    <a href="../../People/Dom/">Dominique Hazael-Massieux</a></address>
    </body>
  </html>
</xsl:template>
</xsl:stylesheet>




