<?xml version='1.0'?>
<!-- command line: java org.apache.xalan.xslt.Process -XSL earl-spec.xsl -OUT earl-spec.html -->

<!-- to do's and such:
      - use rules.n3 from http://infomesh.net/2001/05/rdflint/ to clean up missing definitions...

      Refer to this chat:
      
      22:07:52 <wendy> i'm using XSLT to generate parts of the EARL spec (from the schema), and I'm wondering why some classes are never explicitly declared.
      22:08:03 <wendy> declared/defined (whatever the correct term is).
      22:10:09 <wendy> e.g. testMode is a Property and TestMode is used to create types of testModes (e.g. Manual and Heuristic).
      22:10:53 <wendy> testMode has range of TestMode ...which implies that TestMode is a class.
      22:11:17 <wendy> perhaps that implication is all that is needed...?
      22:12:20 <JibberJim> * JibberJim doesn't understand the question...
      22:17:14 <wendy> in the schema, classes are defined using a statement like:
      22:17:29 <wendy> <rdfs:Class rdf:about="http://www.w3.org/2001/03/earl/1.0-test#Tool">
      22:17:29 <wendy>         <rdfs:comment>This is a tool; a bit of software, perhaps with a desc.</rdfs:comment>
      22:17:29 <wendy>         <rdfs:label>Tool</rdfs:label>
      22:17:36 <wendy> <rdfs:subClassOf rdf:resource="http://www.w3.org/2001/03/earl/1.0-test#TestSubject"/>
      22:17:37 <wendy>     </rdfs:Class>
      22:17:51 <wendy> properties are defined similarly, but with <rdf:Property...>
      22:18:04 <JibberJim> Yep.
      22:18:06 <wendy> however, there seem to be some classes that don't have a "formal" definition, but they are used.
      22:18:08 <wendy> e.g.
      22:18:57 <wendy> TestMode
      
      00:19:59 <sbp> on #swhack...
      00:20:00 <sbp> <sbp> FYI, <rdfs:range rdf:resource="http://www.w3.org/2001/03/earl/1.0-test#TestMode" />
      00:20:00 <sbp> <sbp> the range of range is rdfs:Class
      00:20:14 <sbp> work from the XML RDF version if that's easier for you
      00:22:44 <sbp> you can get some of the "missing" triples from it by running rules.n3 over it
      00:42:17 <wendy> ok. thx. i'll play with rules.n3
-->


<xsl:stylesheet version='1.0' 
   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
   xmlns:earl="http://www.w3.org/2001/03/earl/1.0-test#">

<xsl:output method='html' indent='yes' doctype-public='-//W3C/DTD HTML 4.01 Final//EN'/>

  <!-- versioning variables -->
  <xsl:variable name="draftDate">21 June 2002</xsl:variable>
  <xsl:variable name="thisVersion">http://www.w3.org/WAI/ER/2002/06/21-earl1.html</xsl:variable>
  <xsl:variable name="previousVersion">http://www.w3.org/WAI/ER/2002/06/12-earl1.html</xsl:variable>
  <xsl:variable name="latestVersion">http://www.w3.org/WAI/ER/EARL/</xsl:variable>
  
  <!-- load source files -->
  <xsl:variable name="earlSource" select="document('earl.html')"/>
  <xsl:variable name="earlSchema" select="document('earl1-schema.rdf')"/>  
  
  <xsl:template match='/'>
   <xsl:apply-templates select="$earlSource//div[@id='front-matter']"/>
  </xsl:template>

  <xsl:template match="div[@id='front-matter']">
      <html><head>
               <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD"/>
               <style>
                  .rule {background-color:  #ddeeff; color: black}
                  p {padding-left: 30px}
                  h4 {font-style: italic; padding-left: 10px}
                  caption {margin-top: 1.5em; font-size: 120%; font-weight: bold }
                  table {width: 100%}
               </style>
               <title>Evaluation and Report Language (EARL) 1.0</title>
            </head>
         <body>
            <div class="head">
            <p><a href="http://www.w3.org/">
            <img height="48" width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home" /></a>
            </p></div>
            
            <h1>Evaluation and Report Language (EARL) 1.0</h1>
            <h2>(not yet a) W3C Working Draft <xsl:value-of select="$draftDate"/></h2>
               <dl>
                  <dt>This version:</dt>
                  <dd><a href="{$thisVersion}"><xsl:value-of select="$thisVersion"/></a></dd>
                  <dt>Latest version:</dt>
                  <dd><a href="{$latestVersion}"><xsl:value-of select="$latestVersion"/></a></dd>
                  <dt>Previous version:</dt>
                  <dd><a href="{$previousVersion}"><xsl:value-of select="$previousVersion"/></a></dd>
                  <dt>Editors:</dt>
                  <dd>Wendy Chisholm, W3C<br />
                  Sean B. Palmer</dd>
               </dl>
 
            <p class="copyright">
            <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Copyright"> Copyright</a> 
            &#xA9; 2002 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr>
            </a><sup>&#xAE;</sup> (<a href="http://www.lcs.mit.edu/"><abbr title="Massachusetts Institute 
            of Technology">MIT</abbr></a>, <a href="http://www.inria.fr/"><abbr xml:lang="fr" lang="fr" 
            title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr></a>, 
            <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C 
            <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Legal_Disclaimer">liability</a>, 
            <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#W3C_Trademarks">trademark</a>, 
            <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</a> and 
            <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</a> 
            rules apply.</p>
            <hr/>
            
            <xsl:apply-templates select="$earlSource//div[@id='abstractAndStatus']"/>
            
            <h2><a name="contents" id="contents" accesskey="c">Table of Contents</a></h2>
            <ul>
               <li><a href='#introduction'>1. Introduction</a>
                  <ul><li><a href='#user-scenarios'>User Scenarios</a></li></ul></li>
               <li><a href='#classes'>2. Classes</a></li>
               <li><a href='#properties'>3. Properties</a></li>
               <li><a href='#constraints'>4. Properties of Classes</a></li>
               <li><a href='#extensibility'>5. Extensibility</a></li>
               <li><a href='#examples'>6. Examples</a></li>
               <li><a href='#refs'>7. References</a></li>
               <li><a href='#schema-rdf'>8. Appendix A: EARL Schema in XML RDF</a></li>
               <li><a href='#schema-n3'>9. Appendix B: EARL Schema in N3</a></li>
            </ul>

            <xsl:apply-templates select="$earlSource//div[@id='intro']"/>

            <h2><a name='classes'>2. Classes</a></h2>
            <p>/* brief intro to RDF class/property model */</p>
            <xsl:apply-templates select="$earlSchema//*/rdfs:Class"/>
            
            <h2><a name='properties'>3. Properties</a></h2>
            <xsl:apply-templates select="$earlSchema//*/rdf:Property"/>
            
            <xsl:apply-templates select="$earlSource//div[@id='else']"/>
         </body>
       </html>
  </xsl:template>
  
  <xsl:template match="div[@id='else' or @id='abstractAndStatus' or @id='intro']">
      <xsl:copy-of select='.'/>
  </xsl:template>
  
  <xsl:template match='rdfs:Class'>
      <h3><xsl:value-of select='./rdfs:label'/></h3>
      <xsl:apply-templates select="rdfs:comment"/>
 
      <xsl:variable name='class-instance' select='./rdfs:label'/>
      <h4>Instances of the <xsl:value-of select='$class-instance'/> class</h4>
      
      <ul>
        <xsl:for-each select="/rdf:RDF//earl:*[local-name()=$class-instance]/rdfs:label">
          <!-- @@ need a test here so that if the nodeset is empty, it says "none" -->  
          <li>
            <xsl:value-of select="."/>
          </li>
        </xsl:for-each>
      </ul>
            
      <!-- @@find all Properties whose range and/or domain is this class? -->
         
   </xsl:template>
 
   <!-- Think I can get rid of these...the xsl:for-each should take care of
   <xsl:template match='earl:Validity'>
      <li><xsl:value-of select='./@rdf:about'/></li>
   </xsl:template>
   
   <xsl:template match='earl:TestMode'>
      <li><xsl:value-of select='./@rdf:about'/></li>
   </xsl:template>
   -->

   <xsl:template match='rdf:Property'>
      <h3><xsl:value-of select='./rdfs:label'/></h3>
      <xsl:apply-templates/>
   </xsl:template>
    
   <xsl:template match='rdfs:label'>
   </xsl:template>
   
   <xsl:template match='rdfs:comment'>
      <p><xsl:value-of select='.'/></p>
   </xsl:template>
  
  <xsl:template match='rdfs:domain'>
      <p>The domain of this property is: <xsl:value-of select='./@rdf:resource'/></p>
  </xsl:template>
  
  <xsl:template match='rdfs:range'>
      <p>The range for this property is: <xsl:value-of select='./@rdf:resource'/></p>
  </xsl:template>
  
  <xsl:template match='@rdf:about'>
      <p><xsl:value-of select='.'/></p>
  </xsl:template>


  <!-- when we meet div with id="toc", we include the toc -->
  <!-- we keep the id in it so we can keep doing this -->
  
<!-- xsl:template match="*/category" mode="toc">
      <li><a href="#{@id}"><xsl:value-of select="./@name"/></a></li>
</xsl:template -->

</xsl:stylesheet>

