home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _B9C66B5D112F4289B83560208D1AE451 < prev    next >
Encoding:
Text File  |  2002-10-21  |  8.9 KB  |  246 lines

  1. <!-- 
  2. TEI XSLT stylesheet family version 1.2
  3. RCS: $Date: 2002/10/21 13:44:25 $, $Revision: 1.1.2.1 $, $Author: jdj $
  4.  
  5. XSL stylesheet to format TEI XML documents to HTML or XSL FO
  6.  
  7.  Copyright 1999-2002 Sebastian Rahtz/Oxford University  <sebastian.rahtz@oucs.ox.ac.uk>
  8.  
  9.  Permission is hereby granted, free of charge, to any person obtaining
  10.  a copy of this software and any associated documentation files (the
  11.  ``Software''), to deal in the Software without restriction, including
  12.  without limitation the rights to use, copy, modify, merge, publish,
  13.  distribute, sublicense, and/or sell copies of the Software, and to
  14.  permit persons to whom the Software is furnished to do so, subject to
  15.  the following conditions:
  16.  
  17.  The above copyright notice and this permission notice shall be included
  18.  in all copies or substantial portions of the Software.
  19. --> 
  20.  
  21. <xsl:stylesheet 
  22.   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  23.   version="1.0"  >
  24.  
  25. <xsl:template name="doPageTable">
  26.  <xsl:param name="currentID"/>
  27.  <xsl:variable name="BaseFile">
  28.    <xsl:value-of select="$masterFile"/>
  29.    <xsl:if test="ancestor::teiCorpus.2">
  30.     <xsl:text>-</xsl:text>
  31.      <xsl:choose>
  32.       <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when> 
  33.       <xsl:otherwise><xsl:number/></xsl:otherwise>
  34.      </xsl:choose>
  35.    </xsl:if>
  36.  </xsl:variable>
  37.  
  38.  <xsl:call-template name="outputChunk">
  39.    <xsl:with-param name="ident">
  40.      <xsl:choose>
  41.        <xsl:when test="$STDOUT='true'"/>
  42.        <xsl:when test="not($currentID='')">
  43.          <xsl:value-of select="$currentID"/>
  44.        </xsl:when>
  45.        <xsl:otherwise>
  46.          <xsl:value-of select="$BaseFile"/>         
  47.        </xsl:otherwise>
  48.      </xsl:choose>
  49.    </xsl:with-param>
  50.    <xsl:with-param name="content">
  51.     <xsl:call-template name="tableFrame">       
  52.       <xsl:with-param name="currentID" select="$currentID"/>
  53.     </xsl:call-template>
  54.   </xsl:with-param>
  55.  </xsl:call-template>
  56. </xsl:template>
  57.  
  58. <xsl:template name="tableFrame">
  59. <xsl:param name="currentID"/>
  60.  <html><xsl:call-template name="addLangAtt"/>
  61.  <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. 
  62.               DO NOT EDIT</xsl:comment>
  63.  <head>
  64.    <xsl:variable name="pagetitle">
  65.      <xsl:choose>
  66.       <xsl:when test="$currentID=''">
  67.           <xsl:call-template name="generateTitle"/>
  68.       </xsl:when>
  69.       <xsl:otherwise>
  70.           <xsl:call-template name="generateTitle"/>:
  71.         <xsl:choose>
  72.           <xsl:when test="count(key('IDS',$currentID))>0">
  73.              <xsl:for-each select="key('IDS',$currentID)">  
  74.                 <xsl:apply-templates select="." mode="header"/>
  75.              </xsl:for-each>
  76.           </xsl:when>
  77.           <xsl:otherwise>
  78.            <xsl:apply-templates select="descendant::text" mode="xpath">
  79.                <xsl:with-param name="xpath" select="$currentID" />
  80.                <xsl:with-param name="action" select="'header'" />
  81.            </xsl:apply-templates>
  82.          </xsl:otherwise>
  83.        </xsl:choose>
  84.       </xsl:otherwise>
  85.      </xsl:choose>
  86.    </xsl:variable>
  87.      <title><xsl:value-of select="$pagetitle"/></title>
  88.  <xsl:if test="not($cssFile = '')">
  89.    <link rel="stylesheet" type="text/css" href="{$cssFile}"/>
  90.  </xsl:if>
  91.  <xsl:call-template name="metaHook">
  92.    <xsl:with-param name="title" select="$pagetitle"/>
  93.  </xsl:call-template>
  94.  <xsl:call-template name="javaScript"/>
  95.  </head>
  96.  <body  class="pagetable" >
  97.   <xsl:call-template name="bodyHook"/>
  98.   <xsl:call-template name="bodyJavaScript"/>
  99.  <table border="0">
  100.    <tr>
  101.      <td align="left" valign="top" rowspan="2" width="{$linksWidth}" class="linktext">
  102.        <xsl:call-template name="leftHandFrame">
  103.          <xsl:with-param name="currentID" select="$ID"/>
  104.        </xsl:call-template>
  105.      </td>
  106.      <td  valign="top">
  107.       <xsl:call-template name="generateSubTitle"/>
  108.       <h2 class="maintitle"><xsl:call-template name="generateTitle"/></h2>
  109.      </td>
  110.      <td valign="top">
  111.        <xsl:call-template name="searchbox"/>
  112.      </td>
  113.    </tr>
  114.    <tr>
  115.     <td  valign="top" class="maintext" colspan="2">
  116.       <xsl:call-template name="mainFrame">
  117.          <xsl:with-param name="currentID" select="$currentID"/>
  118.        </xsl:call-template>
  119.      </td>
  120.    </tr>
  121.   </table>
  122.  </body>
  123. </html>
  124. </xsl:template>
  125.  
  126. <xsl:template match="*" mode="paging">
  127.  
  128.   <xsl:choose>
  129.      <xsl:when test="self::divGen[@type='summary']">
  130.            <xsl:call-template name="summaryToc"/>
  131.      </xsl:when>
  132.      <xsl:when test="starts-with(name(),'div')">
  133.       <xsl:if test="not(preceding-sibling::*) or preceding-sibling::titlePage">
  134.            <h2><xsl:apply-templates select="." mode="header"/></h2>
  135.            <xsl:call-template name="doDivBody"/>
  136.                 <xsl:if test="$bottomNavigationPanel='true'">
  137.                  <xsl:call-template name="xrefpanel">
  138.                   <xsl:with-param name="homepage" 
  139.                    select="concat($masterFile,$standardSuffix)"/>
  140.                   <xsl:with-param name="mode" select="name(.)"/>
  141.                  </xsl:call-template>
  142.                 </xsl:if>
  143.       </xsl:if>
  144.      </xsl:when>
  145.      <xsl:otherwise>
  146.        <xsl:apply-templates select="."/>
  147.        <xsl:apply-templates select="following-sibling::*[1]" mode="paging"/>
  148.      </xsl:otherwise>    
  149.   </xsl:choose>
  150.  
  151. </xsl:template>
  152.  
  153.  
  154. <xsl:template name="leftHandFrame">
  155.   <xsl:param name="currentID"/>
  156.      <xsl:call-template name="logoFramePicture"/>
  157.      <br/>
  158.      <a target="_top" href="{$feedbackURL}" class="frametoc">
  159.         <xsl:call-template name="feedbackWords"/></a>
  160.      <br/>
  161.      <hr/>
  162.      <xsl:choose>
  163.       <xsl:when test="$currentID=''">
  164.          <xsl:call-template name="linkListContents">
  165.            <xsl:with-param name="style" select="'frametoc'"/>
  166.          </xsl:call-template>
  167.       </xsl:when>
  168.       <xsl:otherwise>
  169.         <xsl:choose>
  170.           <xsl:when test="count(key('IDS',$currentID))>0">
  171.              <xsl:for-each select="key('IDS',$currentID)">  
  172.                <xsl:call-template name="linkListContents">
  173.                  <xsl:with-param name="style" select="'frametoc'"/>
  174.                </xsl:call-template>
  175.              </xsl:for-each>
  176.           </xsl:when>
  177.           <xsl:otherwise>
  178.            <xsl:apply-templates select="descendant::text" mode="xpath">
  179.                <xsl:with-param name="xpath" select="$currentID" />
  180.                <xsl:with-param name="action" select="'toclist'" />
  181.            </xsl:apply-templates>
  182.         </xsl:otherwise>
  183.        </xsl:choose>
  184.       </xsl:otherwise>
  185.      </xsl:choose>
  186. </xsl:template>
  187.  
  188. <xsl:template name="mainFrame">
  189.  <xsl:param name="currentID"/>
  190.        <xsl:choose>
  191.       <xsl:when test="$currentID=''">
  192.    <!-- we need to locate the first interesting object in the file, ie
  193.     the first grandchild of <text > -->
  194.       <xsl:for-each select=" descendant::text/*[1]/*[1]">
  195.         <xsl:apply-templates select="." mode="paging"/>
  196.         <xsl:if test="following-sibling::div/head">
  197.           <p><b>Sections in this document:</b></p>
  198.           <ul>
  199.               <xsl:apply-templates 
  200.                 select="following-sibling::div" mode="maketoc">
  201.                 <xsl:with-param name="forcedepth" select="'0'"/>
  202.               </xsl:apply-templates>
  203.           </ul>
  204.         </xsl:if>
  205.       </xsl:for-each>
  206.       </xsl:when>
  207.       <xsl:otherwise>
  208.         <xsl:choose>
  209.           <xsl:when test="count(key('IDS',$currentID))>0">
  210.              <xsl:for-each select="key('IDS',$currentID)">  
  211.                 <h2><xsl:apply-templates select="." mode="header"/></h2>
  212.                 <xsl:call-template name="doDivBody"/>
  213.                 <xsl:if test="$bottomNavigationPanel='true'">
  214.                  <xsl:call-template name="xrefpanel">
  215.                   <xsl:with-param name="homepage" 
  216.                    select="concat($masterFile,$standardSuffix)"/>
  217.                   <xsl:with-param name="mode" select="name(.)"/>
  218.                  </xsl:call-template>
  219.                 </xsl:if>
  220.              </xsl:for-each>
  221.           </xsl:when>
  222.           <xsl:otherwise>
  223.            <!-- the passed ID is a pseudo-XPath expression
  224.             which starts below TEI.2/text.
  225.             The real XPath syntax is changed to avoid problems
  226.             -->
  227.            <xsl:apply-templates select="ancestor-or-self::TEI.2/descendant::text" mode="xpath">
  228.                <xsl:with-param name="xpath" select="$currentID" />
  229.            </xsl:apply-templates>
  230.         </xsl:otherwise>
  231.        </xsl:choose>
  232.       </xsl:otherwise>
  233.      </xsl:choose>
  234.      <xsl:call-template name="stdfooter">
  235.           <xsl:with-param name="date">
  236.            <xsl:call-template name="generateDate"/>
  237.           </xsl:with-param>
  238.           <xsl:with-param name="author">
  239.             <xsl:call-template name="generateAuthorList"/>
  240.           </xsl:with-param>
  241.           <xsl:with-param name="style" select="'framestdlink'"/>
  242.       </xsl:call-template>
  243. </xsl:template>
  244. </xsl:stylesheet>
  245.  
  246.