<?xml version="1.0"?>
<!--
$Id: tr-stats.xsl,v 1.33 2006/01/05 20:34:18 matthieu Exp $
-->
<?xml-stylesheet href="http://www.w3.org/2002/07/01-style-xsl.xsl" type="application/xml"?>
<?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"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY rdfuri "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <!ENTITY recuri "http://www.w3.org/2001/02pd/rec54#">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
  xmlns:rec="&recuri;"
  xmlns:contact="http://www.w3.org/2000/10/swap/pim/contact#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:doc="http://www.w3.org/2000/10/swap/pim/doc#"
  xmlns:rdf="&rdfuri;"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:k="http://opencyc.sourceforge.net/daml/cyc.daml#" xmlns:tra="http://www.w3.org/2002/01/tr-automation/process#"
  xmlns:date="http://www.w3.org/2001/08/date-util.xslt"
  exclude-result-prefixes="date rdf rec contact dc doc">
  <xsl:import href="../../../2001/08/date-util.xslt" />

  <xsl:output method="html" indent='yes' doctype-public="-//W3C//DTD HTML 4.01//EN"/>

  <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <title>Stylesheet to compute statistics on recent TR publications</title>
      <link rel="stylesheet" href="http://www.w3.org/StyleSheets/base.css"/>
    </head>
    <body>
      <div class='head'><a href="/"><img src='/Icons/w3c_home' alt='W3C'/></a> <a href="./"><acronym title="Technical Reports">TR</acronym> Automation</a></div>

      <h1>Stylesheet to compute statistics on recent <acronym title="Technical Reports">TR</acronym> publications</h1>
      
      <h2>Abstrat and Status</h2>
      <p>This stylesheet relies on the <a href="tr-logs">lists of RDF logs of <acronym title="Technical Reports">TR</acronym> publications</a> maintained in the <a href="./"><acronym title="Technical Reports">TR</acronym> automation project</a> to get some interesting statistics on <acronym title="Technical Reports">TR</acronym> activity from a given date.</p>
      <p>It is developped as part of the <a href="./"><acronym title="Technical Reports">TR</acronym> automation project</a> and might later get a better integration in the whole <acronym title="Technical Reports">TR</acronym> publication process.</p>
      
      <h2>Statistics</h2>
      <form action="http://www.w3.org/2000/06/webdata/xslt" method="get">
        <div>
          <input type="hidden" name="xslfile" value="http://www.w3.org/2002/01/tr-automation/tr-stats.xsl"/>
          <input type="hidden" name="xmlfile" value="http://www.w3.org/2002/01/tr-automation/tr-logs.rdf"/>
          <p><label>Starting date of statistics: <input type="text" value="2003-03-01" name="startdate" /> (format YYYY-MM-DD; results limited by the oldest entry in the log, i.e. 1995-11-17)</label></p>
          <p><label>Ending date of statistics: <input type="text" value="2003-08-01" name="enddate" /></label></p>
          <p><input type="submit" /></p>
          
        </div>
      </form>
      <h2>See Also</h2>
      <ul>
        <li><a href="tr-count">A style sheet used to compute the current number of documents in each status</a> of the Recommendation Track</li>
        <li><a href="http://www.w3.org/2003/05/tr-history/">History of W3C Recommendations</a></li>
      </ul>

      <address><a href="http://www.w3.org/People/Dom/">Dominique Hazael-Massieux</a> - $Id: tr-stats.xsl,v 1.33 2006/01/05 20:34:18 matthieu Exp $</address>
    </body>
  </html>

  <xsl:param name="startdate" select="'1995-11-17'"/>
  <xsl:param name="enddate" select="'3000-01-01'"/>
  <xsl:param name="xmlfile" select="'http://www.w3.org/2002/01/tr-automation/tr-logs.rdf'"/>

  <xsl:template match="/">
    <html  xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>Statistics on recent TR publications</title>
        <link rel="stylesheet" href="http://www.w3.org/StyleSheets/base.css"/>
      </head>
      <body>
        <div class='head'><a href="/"><img src='/Icons/w3c_home' alt='W3C'/></a> <a href="/2002/01/tr-automation/"><acronym title="Technical Reports">TR</acronym> Automation</a></div>
        
        <h1>Statistics on recent <acronym title="Technical Reports">TR</acronym> publications</h1>
        
        <h2>Abstrat and Status</h2>
        <p>Here are some statistics on the recent activity in <a href="/TR/">TR space</a>. It is computed through a <a href="/2002/01/tr-automation/tr-stats">XSLT stylesheet</a> applied on  the <a href="/2002/01/tr-automation/tr-logs">list of RDF logs of <acronym title="Technical Reports">TR</acronym> publications</a> maintained in the <a href="/2002/01/tr-automation/"><acronym title="Technical Reports">TR</acronym> automation project</a>.</p>
        <p>This could serve as a complement to the <a href="/2001/09/tr-stats">manually computed older <acronym title="Technical Reports">TR</acronym> stats</a> [Member only].</p>
        <h2>Statistics</h2>
        <form action="http://www.w3.org/2000/06/webdata/xslt" method="GET">
          <div>
            <input type="hidden" name="xslfile" value="http://www.w3.org/2002/01/tr-automation/tr-stats.xsl"/>
            <input type="hidden" name="xmlfile" value="{$xmlfile}"/>
            <p><label>Starting date of statistics: <input type="text" value="{$startdate}" name="startdate" /> (format YYYY-MM-DD; results limited by the oldest entry in the log, i.e., 1995-11-17)</label></p>
            <p><label>Ending date of statistics: <input type="text" value="{$enddate}" name="enddate" /></label></p>
            <p><input type="submit" /></p>
            
          </div>
        </form>
        <h3>Statistics computed from <xsl:call-template name="date:makeDateFriendly"><xsl:with-param name="date" select="translate($startdate,'-','')"/></xsl:call-template> to <xsl:call-template name="date:makeDateFriendly"><xsl:with-param name="date" select="translate($enddate,'-','')"/></xsl:call-template></h3>
        <p>Total of <acronym title="Technical Reports">TR</acronym> published during this period: <xsl:apply-templates select="/rdf:RDF/tra:Log[not(k:endingDate &lt; $startdate) and not(k:startingDate &gt; $enddate)][1]" mode="count"/></p>
        <dl>
          <dt>Recommendations</dt>
          <xsl:call-template name="statByStatus">
            <xsl:with-param name="status" select="'REC'"/>
          </xsl:call-template>
          <dt>Proposed Recommendations</dt>
          <xsl:call-template name="statByStatus">
            <xsl:with-param name="status" select="'PR'"/>
          </xsl:call-template>
          <dt>Proposed Edited Recommendations</dt>
          <xsl:call-template name="statByStatus">
            <xsl:with-param name="status" select="'PER'"/>
          </xsl:call-template>
          <dt>Candidate Recommendations</dt>
          <xsl:call-template name="statByStatus">
            <xsl:with-param name="status" select="'CR'"/>
          </xsl:call-template>
          <dt>Last Call</dt>
          <xsl:call-template name="statByStatus">
            <xsl:with-param name="status" select="'LastCall'"/>
          </xsl:call-template>
          <dt>All Working Drafts (last call counted again)</dt>
          <xsl:call-template name="statByStatus">
            <xsl:with-param name="status" select="'WD'"/>
            <xsl:with-param name="details" select="0"/>
          </xsl:call-template>
          <dt>Notes</dt>
          <xsl:call-template name="statByStatus">
            <xsl:with-param name="status" select="'NOTE'"/>
          </xsl:call-template>
        </dl>
      <h2>See Also</h2>
      <ul>
        <li><a href="/2002/01/tr-automation/tr-count">A style sheet used to compute the current number of documents in each status</a> of the Recommendation Track</li>
        <li><a href="http://www.w3.org/2003/05/tr-history/">History of W3C Recommendations</a></li>
      </ul>

        <hr/>
        <address><a href="http://www.w3.org/People/Dom/">Dominique Hazael-Massieux</a> - generated by $Id: tr-stats.xsl,v 1.33 2006/01/05 20:34:18 matthieu Exp $</address>
      </body>
    </html>
    
  </xsl:template>

  <xsl:template name="statByStatus">
    <xsl:param name="status"/>
    <xsl:param name="details" select="1"/>
    <dd>
      <xsl:apply-templates select="/rdf:RDF/tra:Log[not(k:endingDate &lt; $startdate) and not(k:startingDate &gt; $enddate)][1]" mode="count"><xsl:with-param name="status" select="$status"/></xsl:apply-templates> published
      <xsl:if test="$details">
        <xsl:text>:</xsl:text>
        <ul>
          <xsl:apply-templates select="/rdf:RDF/tra:Log[not(k:endingDate &lt; $startdate) and not(k:startingDate &gt; $enddate)][1]" mode="display">
            <xsl:sort select="k:startingDate" order="descending"/>
            <xsl:with-param name="status" select="$status"/>
          </xsl:apply-templates>
        </ul>
      </xsl:if>
    </dd>
  </xsl:template>

  <xsl:template match="tra:Log" mode="count">
    <xsl:param name="status" select="''"/>
    <xsl:variable name="count">
      <xsl:choose>
        <xsl:when test="following-sibling::tra:Log[not(k:endingDate &lt; $startdate) and not(k:startingDate &gt; $enddate)][1]">
          <xsl:apply-templates select="following-sibling::tra:Log[not(k:endingDate &lt; $startdate) and not(k:startingDate &gt; $enddate)][1]" mode="count">
            <xsl:with-param name="status" select="$status"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
          0
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:value-of select="$count + count(document(@rdf:about)/rdf:RDF/*[translate(dc:date,'-','') &gt;= translate($startdate,'-','') and translate(dc:date,'-','') &lt;= translate($enddate,'-','')][$status='' or (local-name()=$status and namespace-uri()='&recuri;') or (./rdf:type[@rdf:resource=concat('&recuri;',$status)])])"/>
  </xsl:template>

  <xsl:template match="tra:Log" mode="display">
    <xsl:param name="status"/>
    <xsl:for-each select="document(@rdf:about)/rdf:RDF/*[translate(dc:date,'-','') &gt;= translate($startdate,'-','') and translate(dc:date,'-','') &lt;= translate($enddate,'-','')][(local-name()=$status and namespace-uri()='&recuri;') or (./rdf:type[@rdf:resource=concat('&recuri;',$status)])]">
      <xsl:sort select="dc:date" order="descending"/>
      <li><a href="{@rdf:about}"><xsl:value-of select="dc:title"/></a></li>
    </xsl:for-each>
    <xsl:apply-templates select="following-sibling::tra:Log[not(k:endingDate &lt; $startdate) and not(k:startingDate &gt; $enddate)][1]" mode="display">
      <xsl:sort select="k:startingDate" order="descending"/>
      <xsl:with-param name="status" select="$status"/>
    </xsl:apply-templates>
  </xsl:template>
</xsl:stylesheet>
