OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xslt-conformance message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: [xslt-conformance] Files


Hi all:

	Attached please see two files to create the
XML and HTML control instances.  The "createxmlControlInstance"
will not assumed any behavior, instead it will select the test and
put a warning on top of it indicating that the specified behavior (if any)
was not defined.

The other file to create the HTML rendition instance should remain the same.

See you at the conference tomorrow.

Carmelo
<?xml version="1.0" encoding="utf-8"?>
<!-- Creates a subset rendition instance from combined test catalog and rendition
     control instance. -->
<!--$Date: 2002/05/21 03:12:48 $(UTC)-->

<!--
Copyright (C) The Organization for the Advancement of
Structured Information Standards [OASIS] (2001). All Rights
Reserved.

This document and translations of it may be copied and
furnished to others, and derivative works that comment on
or otherwise explain it or assist in its implementation may
be prepared, copied, published and distributed, in whole
or in part, without restriction of any kind, provided that the
above copyright notice and this paragraph are included on
all such copies and derivative works. However, this
document itself may not be modified in any way, such as by
removing the copyright notice or references to OASIS,
except as needed for the purpose of developing OASIS
specifications, in which case the procedures for copyrights
defined in the OASIS Intellectual Property Rights document
must be followed, or as required to translate it into
languages other than English.

The limited permissions granted above are perpetual and
will not be revoked by OASIS or its successors or assigns.

This document and the information contained herein is
provided on an "AS IS" basis and OASIS DISCLAIMS ALL
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE
OF THE INFORMATION HEREIN WILL NOT INFRINGE
ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE.
-->

 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">

  <xsl:variable name = "reviewedTestsFile">reviewedTests091102.xml</xsl:variable>
  <xsl:variable name = "discretionaryItemsFile">xsltdisc.xml</xsl:variable>
  <xsl:variable name = "s1">s1</xsl:variable>
  <xsl:variable name = "example1">eXaMpLe</xsl:variable>
  <xsl:variable name = "example1">XampleCo</xsl:variable>

  <!-- Copy the only the nodes that are applicable. -->
  <!-- Any test with a "gray-area" element is eliminated from the -->
  <!-- final rendition. -->

  <!--xsl:template match = "comment()">
   <xsl:comment>
     <xsl:value-of select = "."/>
   </xsl:comment>   
   <xsl:text>&#xA;</xsl:text>
  </xsl:template-->

  <xsl:template match="test-suite">
   <xsl:text> </xsl:text><test-suite><xsl:text>&#xA;</xsl:text>
    <xsl:apply-templates select = "//test-catalog"/>
   <xsl:text> </xsl:text></test-suite>
  </xsl:template>


<!-- For each test in the catalog, check that such test was reviewed
     and a satus code of "s1" was assigned to it.  In other words, it
     was reviewed by two members and it was accepted as a valid test. 
     Also filter out any examples that may be in the catalogue file. -->

  <xsl:template match = "test-catalog">
   <xsl:variable name = "contents"><xsl:value-of select = "."/></xsl:variable>
   <xsl:if test = "not(contains($contents,$example1)) or not(contains($contents,$example1))">
    <xsl:text>  </xsl:text><test-catalog><xsl:text>&#xA;</xsl:text>
     <xsl:if test = "creator">
      <xsl:text>   </xsl:text><creator><xsl:value-of select = "creator"/></creator><xsl:text>&#xA;</xsl:text>
     </xsl:if>
     <xsl:if test = "date">
      <xsl:text>   </xsl:text><date><xsl:value-of select = "date"/></date><xsl:text>&#xA;</xsl:text>
     </xsl:if>
     <xsl:for-each select = "test-case">
      <xsl:variable name = "testId" select = "@id"></xsl:variable>
      <xsl:variable name = "accepted" select = "document($reviewedTestsFile)//test[@id = $testId and @status = $s1]"></xsl:variable>
       <xsl:if test = "(count($accepted) > 0)">
         <xsl:call-template name = "process-testcase"/>
       </xsl:if>
     </xsl:for-each>
    <xsl:text>  </xsl:text></test-catalog><xsl:text>&#xA;</xsl:text>
   </xsl:if>
  </xsl:template>  

  <xsl:template name = "process-testcase">
   <xsl:if test = "not(gray-area)">
      <xsl:choose>
       <xsl:when test = "discretionary/discretionary-choice">
        <xsl:variable name = "disc-name" select = "discretionary/discretionary-choice/@name"/>
        <xsl:variable name = "disc-behavior" select = "discretionary/discretionary-choice/@behavior"/>
        <xsl:variable name = "disc-item-tests" select = "document($discretionaryItemsFile)//item[@id = $disc-name]"/>
        <xsl:variable name = "value1"><xsl:value-of select = "$disc-item-tests//choice[1]/@value"/></xsl:variable>
        <xsl:variable name = "value2"><xsl:value-of select = "$disc-item-tests//choice[2]/@value"/></xsl:variable>
        <xsl:variable name = "items-contents" select = "concat($value1,$value2)"></xsl:variable>

       <!-- Check for the Discretionary item existance.  A value greater than 0 indicates -->
       <!-- that such item was defined. However that is not a suficient condition to -->
       <!-- include the test. It's behavior value must be correct. -->

        <xsl:if test = "count($disc-item-tests) > 0">         
         <xsl:if test = "contains($items-contents,$disc-behavior)">
          <xsl:text>   </xsl:text>
           <xsl:copy-of select = "."/>
           <xsl:text>&#xA;</xsl:text>
         </xsl:if>
        </xsl:if>
     
      <!-- The discretionary item was found in the discretionary items -->
      <!-- file, however the expected behavior does not match any of the -->
      <!-- expected choices.  The test will be included and a warning -->
      <!-- message will be displayed. -->

        <xsl:if test = "count($disc-item-tests) > 0">
         <xsl:if test = "not(contains($items-contents,$disc-behavior))">
          <xsl:comment>Warning: The following test contains a discretionary item whose behavior does not match any of the defined behavior for the discreationary item.</xsl:comment>
           <xsl:text>&#xA;</xsl:text>
           <xsl:text>   </xsl:text>
            <xsl:copy-of select = "."/>
            <xsl:text>&#xA;</xsl:text>
         </xsl:if>
        </xsl:if>
       </xsl:when>

     <!-- This test does not have a "discretionary-item" element at all. -->
     <!-- It will be included in the final rendition.   -->

       <xsl:otherwise>
        <xsl:text>   </xsl:text>
        <xsl:copy-of select = "."/>
        <xsl:text>&#xA;</xsl:text>
       </xsl:otherwise>
      </xsl:choose>
   </xsl:if>
 </xsl:template>
</xsl:stylesheet>
<?xsl version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:variable name = "xsltdmt">XSLT-Data-Manipulation</xsl:variable>
  <xsl:variable name = "xsltdmot">XSLT-Data-Model</xsl:variable>
  <xsl:variable name = "xslttt">XSLT-Template</xsl:variable>
  <xsl:variable name = "xsltst">XSLT-Structure</xsl:variable>
  <xsl:variable name = "xsltrtt">XSLT-Result-Tree</xsl:variable>
  <xsl:variable name = "xsltot">XSLT-Output</xsl:variable>
  <xsl:variable name = "xsltext">XSLT-Extendability</xsl:variable>
  <xsl:variable name = "xpathcft">XPath-Core-Function</xsl:variable>
  <xsl:variable name = "xpathdmot">XPath-Data-Model</xsl:variable>
  <xsl:variable name = "xpathexpt">XPath-Expression</xsl:variable>
  <xsl:variable name = "xpathlpt">XPath-Location-Path</xsl:variable>
  <xsl:variable name = "mixed">Mixed</xsl:variable>
  <xsl:variable name = "documentation">documentation.xml</xsl:variable>
  <xsl:variable name = "xslt">http://www.w3.org/TR/xslt</xsl:variable>
  <xsl:variable name = "xpath">http://www.w3.org/TR/xpath</xsl:variable>
  <xsl:variable name = "errata">http://www.w3.org/1999/11/REC-xslt-19991116-errata</xsl:variable>

  <xsl:template match="/">
    <xsl:apply-templates select = "test-suite"/>
  </xsl:template>
 
  <xsl:template match="test-suite">
   <html>
    <head>
     <style>
      BODY {
       font-family: Lucida, Helvetica, Univers, sans-serif;
      }
      H1, H2, H3
      {
       text-align: left;
       color: #0066CC;
      }
      H4
      {
       color: #0066CC;
      }
     </style>
    </head>

    <body bgcolor="#ffffff">     

       <xsl:apply-templates select = "document($documentation)//heading[@id='topHeading']"/>
       <xsl:apply-templates select = "document($documentation)//heading[@id='toc']"/>
       <xsl:apply-templates select = "document($documentation)//heading[@id='introd']"/>
       <xsl:apply-templates select = "document($documentation)//heading[@id='categories']"/>
       <xsl:apply-templates select = "document($documentation)//heading[@id='allowable']"/>
       <xsl:apply-templates select = "document($documentation)//heading[@id='descrip']"/>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltdmt']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xsltdmt"/>
       </xsl:call-template>
 
       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltdmot']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xsltdmot"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltext']"/>
       <xsl:call-template name = "test-case">      
         <xsl:with-param name = "category" select = "$xsltext"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltot']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xsltot"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltrtt']"/> 
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xsltrtt"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltst']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xsltst"/>      
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xslttt']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xslttt"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xpathlpt']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xpathlpt"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xpathexpt']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xpathexpt"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xpathcft']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xpathcft"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xpathdmot']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xpathdmot"/>
       </xsl:call-template> 

       <xsl:apply-templates select = "document($documentation)//heading[@id='mixed']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$mixed"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='contrib']"/>
      </body>
     </html>
  </xsl:template>

  <xsl:template name = "lessThan">
    <xsl:text disable-output-escaping = "yes">&lt;</xsl:text>
  </xsl:template>

  <xsl:template name = "greaterThan">
    <xsl:text disable-output-escaping = "yes">&gt;</xsl:text>
  </xsl:template>

  <xsl:template name = "slash">
    <xsl:text>/</xsl:text>
  </xsl:template>

  <xsl:template name = "buildHeading">
   <xsl:param name = "id"/>
   <xsl:param name = "value"/>
   <xsl:param name = "level"/>
   <a name = "{$id}">
    <xsl:call-template name = "lessThan"/>
    <xsl:value-of select = "$level"/>
    <xsl:call-template name = "greaterThan"/>
    <xsl:value-of select = "$value"/>
    <xsl:call-template name = "lessThan"/>
    <xsl:call-template name = "slash"/>
    <xsl:value-of select = "$level"/>
    <xsl:call-template name = "greaterThan"/>
   </a>
  </xsl:template>

  <xsl:template name = "buildTOC">
   <ol>
    <xsl:for-each select = "item">
     <li><a href = "#{@id}"><xsl:value-of select = "@value"/></a></li>
     <xsl:if test = "sub-item">
      <ol>
       <xsl:for-each select = "sub-item">
        <li><a href = "#{@id}"><xsl:value-of select = "@value"/></a></li>
       </xsl:for-each>
      </ol>
     </xsl:if>
    </xsl:for-each>
   </ol>
  </xsl:template>

  <xsl:template match = "//heading[contains(@id,'xslt') or contains(@id,'xpath') or contains(@id,'mixed')]">
   <xsl:call-template name = "buildHeading">
    <xsl:with-param name = "id"><xsl:value-of select = "@id"/></xsl:with-param>
    <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
    <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
   </xsl:call-template>

   <xsl:if test = "content">
    <p><xsl:value-of select = "content"/></p>
   </xsl:if>
  </xsl:template>

  <xsl:template match = "//heading[@id='toc']">
   <xsl:call-template name = "buildHeading">
    <xsl:with-param name = "id"><xsl:value-of select = "@lid"/></xsl:with-param>
    <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
    <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
   </xsl:call-template>

   <xsl:if test = "content">
     <p><xsl:value-of select = "content"/></p>
    </xsl:if>
    <xsl:call-template name = "buildTOC"/>
  </xsl:template>

  <xsl:template match = "//heading[@id='topHeading']">
   <xsl:copy-of select = "."/>
  </xsl:template>

  <xsl:template match = "//heading[@id='introd']">
   <a name = "{@id}">
    <xsl:call-template name = "buildHeading">
     <xsl:with-param name = "id"><xsl:value-of select = "@id"/></xsl:with-param>
     <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
     <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
    </xsl:call-template>
   </a>

   <xsl:if test = "content">
    <p>
     <xsl:copy-of select = "."/>
    </p>
   </xsl:if>
  </xsl:template>

  <xsl:template match = "//heading[@id='categories']">
   <a name = "{@id}">
    <xsl:call-template name = "buildHeading">
     <xsl:with-param name = "id"><xsl:value-of select = "@lid"/></xsl:with-param>
     <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
     <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
    </xsl:call-template>
   </a>

   <xsl:if test = "content">
     <p><xsl:value-of select = "content"/></p>
   </xsl:if>
  </xsl:template>

  <xsl:template match = "//heading[@id='allowable']">
   <center>
    <a name = "{@id}">
     <xsl:call-template name = "buildHeading">
      <xsl:with-param name = "id"><xsl:value-of select = "@lid"/></xsl:with-param>
      <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
      <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
     </xsl:call-template>
    </a>
   </center>

   <xsl:if test = "content">
    <p><xsl:value-of select = "content"/></p>
   </xsl:if>

   <xsl:if test = "table">
    <center>
     <xsl:copy-of select = "table"/>
    </center>
   </xsl:if>
  </xsl:template>

  <xsl:template match = "//heading[@id ='contrib']">
   <a name = "{@id}">
    <xsl:call-template name = "buildHeading">
     <xsl:with-param name = "id"><xsl:value-of select = "@lid"/></xsl:with-param>
     <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
     <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
    </xsl:call-template>
   </a>

   <xsl:if test = "content">
    <p><xsl:value-of select = "content"/></p>
   </xsl:if>
    <ul>
     <xsl:for-each select = "contributor">
      <li><xsl:value-of select = "."/></li>
     </xsl:for-each>
    </ul>
  </xsl:template>

  <xsl:template match = "//heading[@id='descrip']">
   <a name = "{@id}">
    <xsl:call-template name = "buildHeading">
     <xsl:with-param name = "id"><xsl:value-of select = "@lid"/></xsl:with-param>
     <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
     <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
    </xsl:call-template>
   </a>

   <xsl:if test = "content">
     <p><xsl:value-of select = "content"/></p>
   </xsl:if>
  </xsl:template>
  
  <xsl:template name = "test-case">
   <xsl:param name = "category"/>
   <xsl:variable name = "totalTests"><xsl:value-of select = "count(//test-case[@category = $category])"/></xsl:variable>
   <xsl:if test = "$totalTests = 0">
    <table>
     <tr valign="top">
      <td bgcolor='#ffffcc'>
       No tests are available for this category.
      </td>
     </tr>
    </table> 
   </xsl:if>  
   <xsl:if test = "$totalTests > 0">
    <xsl:for-each select = "//test-case[(@category = $category) and not(contains(@id,'Xample'))]">
     <table width="100%">
      <tr valign="top">
       <td width='40%'>
        <table bgcolor='#eeeeff' border='1' width='100%' height="100%">
         <tr>
          <td width='50%'><b>Sections/Places</b></td>
          <td bgcolor='#ffffcc'>
           <xsl:for-each select = "spec-citation">
            <xsl:choose>
             <xsl:when test = "(@spec = 'xslt') or (@spec = 'XSLT')">
              <xsl:call-template name = "build-citation">
               <xsl:with-param name = "specs" select = "$xslt"/>
              </xsl:call-template>
             </xsl:when>
             <xsl:when test = "@spec = 'XSLT-Errata'">
              <xsl:call-template name = "build-citation">
               <xsl:with-param name = "specs" select = "$errata"/>
              </xsl:call-template>
             </xsl:when>
             <xsl:when test = "@spec = 'xpath' or @spec = 'XPath'">
              <xsl:call-template name = "build-citation">
               <xsl:with-param name = "specs" select = "$xpath"/>
              </xsl:call-template>
             </xsl:when>
            </xsl:choose>
           </xsl:for-each>
          </td>
         </tr>
         <tr valign="top">
          <td width='50%'><b>Test ID:</b></td>
          <td bgcolor='#ffffcc'>
           <xsl:value-of select="@id"/></td>
         </tr>
         <xsl:if test="../creator">
          <tr valign="top">
           <td width='50%'><b>Collection:</b></td>
           <td bgcolor='#ffffcc'>
            <xsl:value-of select="../creator"/>
           </td>
          </tr>
         </xsl:if>
        </table>
       </td>
       <td bgcolor='#ccffff'>
        <xsl:value-of select = "purpose"/>
        <xsl:if test="descendant::output-file">
         <p>There is an output test associated with this input file.</p>
        </xsl:if>
       </td>
      </tr>
     </table>
    </xsl:for-each>
   </xsl:if>
  </xsl:template>

<!-- The first "when" on the following "choose" is ONLY temporary to
     accomodate inconsistensies with the Microsoft catalog file.  -->

  <xsl:template name = "build-citation">
   <xsl:param name = "specs"/>
     <xsl:choose>
      <xsl:when test = "((@type = 'Xpointer') or (@type = 'XPointer')) and not(contains(@place,'('))">
       <xsl:choose>
        <xsl:when test = "@place = '7.7.1' or contains(@place,'7.7.1')">
         <a href = "{$specs}#convert"><xsl:value-of select = "substring-before(@place,' ')"/></a>
        </xsl:when>
        <xsl:when test = "@place = '7.7' or contains(@place,'7.7')">
         <a href = "{$specs}#number"><xsl:value-of select = "substring-before(@place,' ')"/></a>
        </xsl:when>
        <xsl:otherwise>
         <a href = "{$specs}{@place}"><xsl:value-of select = "substring-before(@place,' ')"/></a>
        </xsl:otherwise>
       </xsl:choose>
       <br/>
      </xsl:when>
      <xsl:when test = "@type = 'section'">
       <xsl:choose>
        <xsl:when test = "@place = '7.7.1' or contains(@place,'7.7.1')">
         <a href = "{$specs}#convert"><xsl:value-of select = "@place"/></a>
        </xsl:when>
        <xsl:when test = "@place = '7.7' or contains(@place,'7.7')">
         <a href = "{$specs}#number"><xsl:value-of select = "@place"/></a>
        </xsl:when>
        <xsl:otherwise>
         <a href = "{$specs}"><xsl:value-of select = "@place"/></a>
        </xsl:otherwise>
       </xsl:choose>
       <br/>
      </xsl:when>
      <xsl:when test = "@type = 'anchor'">
       <a href= "{$specs}#{@place}"><xsl:value-of select = "@place"/></a>
       <br/>
      </xsl:when>
      <xsl:when test = "(@type = 'Xpointer') or (@type = 'XPointer')">
       <xsl:variable name = "value"><xsl:value-of select = "substring-after(substring-before(@place,')'),'(')"/></xsl:variable>
        <xsl:if test = "(count(preceding-sibling::*[contains(@place,$value)]) = 0) or ((count(following-sibling::*[contains(@place,$value)]) = 0) and (position != last()))">
         <a href= "{$specs}#{$value}"><xsl:value-of select = "$value"/></a>
         <br/>
        </xsl:if>
      </xsl:when>
     </xsl:choose>
 </xsl:template>
</xsl:stylesheet>
<?xsl version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:variable name = "xsltdmt">XSLT-Data-Manipulation</xsl:variable>
  <xsl:variable name = "xsltdmot">XSLT-Data-Model</xsl:variable>
  <xsl:variable name = "xslttt">XSLT-Template</xsl:variable>
  <xsl:variable name = "xsltst">XSLT-Structure</xsl:variable>
  <xsl:variable name = "xsltrtt">XSLT-Result-Tree</xsl:variable>
  <xsl:variable name = "xsltot">XSLT-Output</xsl:variable>
  <xsl:variable name = "xsltext">XSLT-Extendability</xsl:variable>
  <xsl:variable name = "xpathcft">XPath-Core-Function</xsl:variable>
  <xsl:variable name = "xpathdmot">XPath-Data-Model</xsl:variable>
  <xsl:variable name = "xpathexpt">XPath-Expression</xsl:variable>
  <xsl:variable name = "xpathlpt">XPath-Location-Path</xsl:variable>
  <xsl:variable name = "mixed">Mixed</xsl:variable>
  <xsl:variable name = "documentation">documentation.xml</xsl:variable>
  <xsl:variable name = "xslt">http://www.w3.org/TR/xslt</xsl:variable>
  <xsl:variable name = "xpath">http://www.w3.org/TR/xpath</xsl:variable>
  <xsl:variable name = "errata">http://www.w3.org/1999/11/REC-xslt-19991116-errata</xsl:variable>

  <xsl:template match="/">
    <xsl:apply-templates select = "test-suite"/>
  </xsl:template>
 
  <xsl:template match="test-suite">
   <html>
    <head>
     <style>
      BODY {
       font-family: Lucida, Helvetica, Univers, sans-serif;
      }
      H1, H2, H3
      {
       text-align: left;
       color: #0066CC;
      }
      H4
      {
       color: #0066CC;
      }
     </style>
    </head>

    <body bgcolor="#ffffff">     

       <xsl:apply-templates select = "document($documentation)//heading[@id='topHeading']"/>
       <xsl:apply-templates select = "document($documentation)//heading[@id='toc']"/>
       <xsl:apply-templates select = "document($documentation)//heading[@id='introd']"/>
       <xsl:apply-templates select = "document($documentation)//heading[@id='categories']"/>
       <xsl:apply-templates select = "document($documentation)//heading[@id='allowable']"/>
       <xsl:apply-templates select = "document($documentation)//heading[@id='descrip']"/>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltdmt']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xsltdmt"/>
       </xsl:call-template>
 
       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltdmot']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xsltdmot"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltext']"/>
       <xsl:call-template name = "test-case">      
         <xsl:with-param name = "category" select = "$xsltext"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltot']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xsltot"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltrtt']"/> 
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xsltrtt"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xsltst']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xsltst"/>      
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xslttt']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xslttt"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xpathlpt']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xpathlpt"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xpathexpt']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xpathexpt"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xpathcft']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xpathcft"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='xpathdmot']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$xpathdmot"/>
       </xsl:call-template> 

       <xsl:apply-templates select = "document($documentation)//heading[@id='mixed']"/>
       <xsl:call-template name = "test-case">
        <xsl:with-param name = "category" select = "$mixed"/>
       </xsl:call-template>

       <xsl:apply-templates select = "document($documentation)//heading[@id='contrib']"/>
      </body>
     </html>
  </xsl:template>

  <xsl:template name = "lessThan">
    <xsl:text disable-output-escaping = "yes">&lt;</xsl:text>
  </xsl:template>

  <xsl:template name = "greaterThan">
    <xsl:text disable-output-escaping = "yes">&gt;</xsl:text>
  </xsl:template>

  <xsl:template name = "slash">
    <xsl:text>/</xsl:text>
  </xsl:template>

  <xsl:template name = "buildHeading">
   <xsl:param name = "id"/>
   <xsl:param name = "value"/>
   <xsl:param name = "level"/>
   <a name = "{$id}">
    <xsl:call-template name = "lessThan"/>
    <xsl:value-of select = "$level"/>
    <xsl:call-template name = "greaterThan"/>
    <xsl:value-of select = "$value"/>
    <xsl:call-template name = "lessThan"/>
    <xsl:call-template name = "slash"/>
    <xsl:value-of select = "$level"/>
    <xsl:call-template name = "greaterThan"/>
   </a>
  </xsl:template>

  <xsl:template name = "buildTOC">
   <ol>
    <xsl:for-each select = "item">
     <li><a href = "#{@id}"><xsl:value-of select = "@value"/></a></li>
     <xsl:if test = "sub-item">
      <ol>
       <xsl:for-each select = "sub-item">
        <li><a href = "#{@id}"><xsl:value-of select = "@value"/></a></li>
       </xsl:for-each>
      </ol>
     </xsl:if>
    </xsl:for-each>
   </ol>
  </xsl:template>

  <xsl:template match = "//heading[contains(@id,'xslt') or contains(@id,'xpath') or contains(@id,'mixed')]">
   <xsl:call-template name = "buildHeading">
    <xsl:with-param name = "id"><xsl:value-of select = "@id"/></xsl:with-param>
    <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
    <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
   </xsl:call-template>

   <xsl:if test = "content">
    <p><xsl:value-of select = "content"/></p>
   </xsl:if>
  </xsl:template>

  <xsl:template match = "//heading[@id='toc']">
   <xsl:call-template name = "buildHeading">
    <xsl:with-param name = "id"><xsl:value-of select = "@lid"/></xsl:with-param>
    <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
    <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
   </xsl:call-template>

   <xsl:if test = "content">
     <p><xsl:value-of select = "content"/></p>
    </xsl:if>
    <xsl:call-template name = "buildTOC"/>
  </xsl:template>

  <xsl:template match = "//heading[@id='topHeading']">
   <xsl:copy-of select = "."/>
  </xsl:template>

  <xsl:template match = "//heading[@id='introd']">
   <a name = "{@id}">
    <xsl:call-template name = "buildHeading">
     <xsl:with-param name = "id"><xsl:value-of select = "@id"/></xsl:with-param>
     <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
     <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
    </xsl:call-template>
   </a>

   <xsl:if test = "content">
    <p>
     <xsl:copy-of select = "."/>
    </p>
   </xsl:if>
  </xsl:template>

  <xsl:template match = "//heading[@id='categories']">
   <a name = "{@id}">
    <xsl:call-template name = "buildHeading">
     <xsl:with-param name = "id"><xsl:value-of select = "@lid"/></xsl:with-param>
     <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
     <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
    </xsl:call-template>
   </a>

   <xsl:if test = "content">
     <p><xsl:value-of select = "content"/></p>
   </xsl:if>
  </xsl:template>

  <xsl:template match = "//heading[@id='allowable']">
   <center>
    <a name = "{@id}">
     <xsl:call-template name = "buildHeading">
      <xsl:with-param name = "id"><xsl:value-of select = "@lid"/></xsl:with-param>
      <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
      <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
     </xsl:call-template>
    </a>
   </center>

   <xsl:if test = "content">
    <p><xsl:value-of select = "content"/></p>
   </xsl:if>

   <xsl:if test = "table">
    <center>
     <xsl:copy-of select = "table"/>
    </center>
   </xsl:if>
  </xsl:template>

  <xsl:template match = "//heading[@id ='contrib']">
   <a name = "{@id}">
    <xsl:call-template name = "buildHeading">
     <xsl:with-param name = "id"><xsl:value-of select = "@lid"/></xsl:with-param>
     <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
     <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
    </xsl:call-template>
   </a>

   <xsl:if test = "content">
    <p><xsl:value-of select = "content"/></p>
   </xsl:if>
    <ul>
     <xsl:for-each select = "contributor">
      <li><xsl:value-of select = "."/></li>
     </xsl:for-each>
    </ul>
  </xsl:template>

  <xsl:template match = "//heading[@id='descrip']">
   <a name = "{@id}">
    <xsl:call-template name = "buildHeading">
     <xsl:with-param name = "id"><xsl:value-of select = "@lid"/></xsl:with-param>
     <xsl:with-param name = "value"><xsl:value-of select = "@value"/></xsl:with-param>
     <xsl:with-param name = "level"><xsl:value-of select = "@level"/></xsl:with-param>
    </xsl:call-template>
   </a>

   <xsl:if test = "content">
     <p><xsl:value-of select = "content"/></p>
   </xsl:if>
  </xsl:template>
  
  <xsl:template name = "test-case">
   <xsl:param name = "category"/>
   <xsl:variable name = "totalTests"><xsl:value-of select = "count(//test-case[@category = $category])"/></xsl:variable>
   <xsl:if test = "$totalTests = 0">
    <table>
     <tr valign="top">
      <td bgcolor='#ffffcc'>
       No tests are available for this category.
      </td>
     </tr>
    </table> 
   </xsl:if>  
   <xsl:if test = "$totalTests > 0">
    <xsl:for-each select = "//test-case[(@category = $category) and not(contains(@id,'Xample'))]">
     <table width="100%">
      <tr valign="top">
       <td width='40%'>
        <table bgcolor='#eeeeff' border='1' width='100%' height="100%">
         <tr>
          <td width='50%'><b>Sections/Places</b></td>
          <td bgcolor='#ffffcc'>
           <xsl:for-each select = "spec-citation">
            <xsl:choose>
             <xsl:when test = "(@spec = 'xslt') or (@spec = 'XSLT')">
              <xsl:call-template name = "build-citation">
               <xsl:with-param name = "specs" select = "$xslt"/>
              </xsl:call-template>
             </xsl:when>
             <xsl:when test = "@spec = 'XSLT-Errata'">
              <xsl:call-template name = "build-citation">
               <xsl:with-param name = "specs" select = "$errata"/>
              </xsl:call-template>
             </xsl:when>
             <xsl:when test = "@spec = 'xpath' or @spec = 'XPath'">
              <xsl:call-template name = "build-citation">
               <xsl:with-param name = "specs" select = "$xpath"/>
              </xsl:call-template>
             </xsl:when>
            </xsl:choose>
           </xsl:for-each>
          </td>
         </tr>
         <tr valign="top">
          <td width='50%'><b>Test ID:</b></td>
          <td bgcolor='#ffffcc'>
           <xsl:value-of select="@id"/></td>
         </tr>
         <xsl:if test="../creator">
          <tr valign="top">
           <td width='50%'><b>Collection:</b></td>
           <td bgcolor='#ffffcc'>
            <xsl:value-of select="../creator"/>
           </td>
          </tr>
         </xsl:if>
        </table>
       </td>
       <td bgcolor='#ccffff'>
        <xsl:value-of select = "purpose"/>
        <xsl:if test="descendant::output-file">
         <p>There is an output test associated with this input file.</p>
        </xsl:if>
       </td>
      </tr>
     </table>
    </xsl:for-each>
   </xsl:if>
  </xsl:template>

<!-- The first "when" on the following "choose" is ONLY temporary to
     accomodate inconsistensies with the Microsoft catalog file.  -->

  <xsl:template name = "build-citation">
   <xsl:param name = "specs"/>
     <xsl:choose>
      <xsl:when test = "((@type = 'Xpointer') or (@type = 'XPointer')) and not(contains(@place,'('))">
       <xsl:choose>
        <xsl:when test = "@place = '7.7.1' or contains(@place,'7.7.1')">
         <a href = "{$specs}#convert"><xsl:value-of select = "substring-before(@place,' ')"/></a>
        </xsl:when>
        <xsl:when test = "@place = '7.7' or contains(@place,'7.7')">
         <a href = "{$specs}#number"><xsl:value-of select = "substring-before(@place,' ')"/></a>
        </xsl:when>
        <xsl:otherwise>
         <a href = "{$specs}{@place}"><xsl:value-of select = "substring-before(@place,' ')"/></a>
        </xsl:otherwise>
       </xsl:choose>
       <br/>
      </xsl:when>
      <xsl:when test = "@type = 'section'">
       <xsl:choose>
        <xsl:when test = "@place = '7.7.1' or contains(@place,'7.7.1')">
         <a href = "{$specs}#convert"><xsl:value-of select = "@place"/></a>
        </xsl:when>
        <xsl:when test = "@place = '7.7' or contains(@place,'7.7')">
         <a href = "{$specs}#number"><xsl:value-of select = "@place"/></a>
        </xsl:when>
        <xsl:otherwise>
         <a href = "{$specs}"><xsl:value-of select = "@place"/></a>
        </xsl:otherwise>
       </xsl:choose>
       <br/>
      </xsl:when>
      <xsl:when test = "@type = 'anchor'">
       <a href= "{$specs}#{@place}"><xsl:value-of select = "@place"/></a>
       <br/>
      </xsl:when>
      <xsl:when test = "(@type = 'Xpointer') or (@type = 'XPointer')">
       <xsl:variable name = "value"><xsl:value-of select = "substring-after(substring-before(@place,')'),'(')"/></xsl:variable>
        <xsl:if test = "(count(preceding-sibling::*[contains(@place,$value)]) = 0) or ((count(following-sibling::*[contains(@place,$value)]) = 0) and (position != last()))">
         <a href= "{$specs}#{$value}"><xsl:value-of select = "$value"/></a>
         <br/>
        </xsl:if>
      </xsl:when>
     </xsl:choose>
 </xsl:template>
</xsl:stylesheet>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC