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

  1. <!-- 
  2. TEI XSLT stylesheet family version 1.2
  3. RCS: $Date: 2002/10/21 13:44:18 $, $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="doFrames">
  26.  
  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:choose>
  39.   <xsl:when test="$ID='frametoc___'">
  40.      <xsl:call-template name="writeFrameToc"/>
  41.   </xsl:when>
  42.   <xsl:when test="$STDOUT='true'">
  43.         <xsl:call-template name="writeFrameMain">
  44.       <xsl:with-param name="base" select="$BaseFile"/>
  45.     </xsl:call-template>        
  46.   </xsl:when>
  47.   <xsl:otherwise>
  48.         
  49.    <xsl:call-template name="outputChunk">
  50.    <xsl:with-param name="ident">
  51.      <xsl:value-of select="concat($BaseFile,'-menubar')"/>
  52.    </xsl:with-param>
  53.    <xsl:with-param name="content">
  54.     <xsl:call-template name="writeFrameToc"/>
  55.    </xsl:with-param>
  56.    </xsl:call-template>
  57.  
  58.    <xsl:call-template name="outputChunk">
  59.    <xsl:with-param name="ident">
  60.      <xsl:value-of select="concat($BaseFile,'-frames')"/>
  61.    </xsl:with-param>
  62.    <xsl:with-param name="content">
  63.          <xsl:call-template name="writeFrameMain">
  64.       <xsl:with-param name="base" select="$BaseFile"/>
  65.     </xsl:call-template>
  66.    </xsl:with-param>
  67.    </xsl:call-template>
  68.   
  69.    <xsl:apply-templates select="TEI.2" mode="split"/>
  70.   </xsl:otherwise>
  71.  </xsl:choose>
  72. </xsl:template>
  73.  
  74. <xsl:template name="writeFrameToc">
  75. <html><xsl:call-template name="addLangAtt"/>
  76.  <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. 
  77.  DO NOT EDIT</xsl:comment>
  78.  <head>
  79.  <title><xsl:call-template name="generateTitle"/></title>
  80.  <xsl:if test="not($cssFile = '')">
  81.    <link rel="stylesheet" type="text/css" href="{$cssFile}"/>
  82.  </xsl:if>
  83.  <base target="framemain"/>
  84.  </head>
  85.  <body class="framemenu">
  86.  <xsl:call-template name="logoFramePicture"/><br/><xsl:text>
  87. </xsl:text>
  88.  <xsl:call-template name="linkListContents">
  89.       <xsl:with-param name="style" select="'frametoc'"/>
  90.  </xsl:call-template>
  91.  <xsl:call-template name="stdfooterFrame">
  92.           <xsl:with-param name="date">
  93.            <xsl:call-template name="generateDate"/>
  94.           </xsl:with-param>
  95.           <xsl:with-param name="author">
  96.             <xsl:call-template name="generateAuthorList"/>
  97.           </xsl:with-param>
  98.           <xsl:with-param name="style" select="'framestdlink'"/>
  99.   </xsl:call-template>
  100.  </body>
  101. </html>
  102. </xsl:template>
  103.  
  104. <xsl:template name="writeFrameMain">
  105.  <xsl:param name="base"/>
  106.  <xsl:variable name="firstfile">
  107.    <xsl:if test="$STDOUT='true'">
  108.      <xsl:value-of select="$masterFile"/>
  109.      <xsl:value-of select="$urlChunkPrefix"/>
  110.    </xsl:if>
  111.    <!-- we need to locate the first interesting object in the file, ie
  112.     the first grandchild of <text > -->
  113.     <xsl:for-each select="descendant::text/*[1]/*[1]">
  114.       <xsl:choose>
  115.         <xsl:when test="starts-with(name(),'div')">
  116.             <xsl:apply-templates select="." mode="ident"/>
  117.         </xsl:when>
  118.         <xsl:otherwise>
  119.           <xsl:choose>
  120.            <xsl:when test="$STDOUT='true'">
  121.         <xsl:text>prelim___</xsl:text>
  122.            </xsl:when>
  123.            <xsl:otherwise>
  124.              <xsl:value-of select="$base"/>
  125.            </xsl:otherwise>
  126.           </xsl:choose>
  127.         </xsl:otherwise>
  128.       </xsl:choose>
  129.     </xsl:for-each>
  130.   <xsl:value-of select="$standardSuffix"/>
  131.  </xsl:variable>
  132.  <xsl:variable name="frameAlternate">
  133.   <xsl:choose>
  134.    <xsl:when test="$STDOUT='true'">
  135.      <xsl:value-of select="concat($base,$standardSuffix)"/>  
  136.      <xsl:text>?makeFrames=false&autoToc=true</xsl:text>
  137.    </xsl:when>
  138.    <xsl:when test="$frameAlternateURL">
  139.      <xsl:value-of select="$frameAlternateURL"/>  
  140.    </xsl:when>
  141.    <xsl:otherwise>
  142.      <xsl:value-of select="concat($base,$standardSuffix)"/>  
  143.    </xsl:otherwise>
  144.   </xsl:choose>
  145.  </xsl:variable>
  146.  
  147.  <xsl:variable name="frametoc">
  148.  <xsl:value-of select="$base"/>
  149.  <xsl:choose>
  150.    <xsl:when test="$STDOUT='true'">
  151.      <xsl:text>.ID=frametoc___</xsl:text>
  152.    </xsl:when>
  153.    <xsl:otherwise>
  154.      <xsl:text>-menubar.html</xsl:text>
  155.    </xsl:otherwise>
  156.  </xsl:choose>
  157. </xsl:variable>
  158.  
  159. <html><xsl:call-template name="addLangAtt"/>
  160.  <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. 
  161.  DO NOT EDIT</xsl:comment>
  162.  <head>
  163.  <meta name="robots" content="noindex,follow"/>
  164.  <title><xsl:call-template name="generateTitle"/></title>
  165.  <xsl:if test="not($cssFile = '')">
  166.    <link rel="stylesheet" type="text/css" href="{$cssFile}"/>
  167.  </xsl:if>
  168.  </head>
  169.   <frameset cols="{$frameCols}"> 
  170.     <frame src="{$frametoc}"  name="framemenu"/>
  171.     <frame src="{$firstfile}" name="framemain"/> 
  172.     <noframes> 
  173.      <body bgcolor="#ffffff"> 
  174.     <p><i>Sorry, this document requires a browser that can view frames.</i></p>
  175.     <p><b>Look at <a href="{$frameAlternate}">
  176.          <xsl:value-of select="$frameAlternate"/></a> instead.</b></p>
  177.      </body> 
  178.     </noframes>
  179. </frameset>
  180. </html>
  181. </xsl:template>
  182.  
  183.  
  184. <xsl:template name="linkList">
  185. <xsl:param name="side"/>
  186. <xsl:param name="simple"/>
  187.  
  188.    <table class="{$side}links">
  189.    <tr>
  190.      <xsl:if test="$side='right'">
  191.        <td valign="top">         <xsl:choose>
  192.          <xsl:when test="$simple='true'">
  193.            <xsl:call-template name="simpleBody"/>
  194.          </xsl:when>
  195.          <xsl:otherwise>
  196.            <xsl:apply-templates/>
  197.          </xsl:otherwise>
  198.        </xsl:choose>
  199.        </td>
  200.      </xsl:if>
  201.      <td width="{$linksWidth}" class="framemenu" valign="top">
  202.      <xsl:call-template name="linkListContents">
  203.         <xsl:with-param name="style" select="'frametoc'"/>
  204.      </xsl:call-template>
  205.      </td>
  206.      <xsl:if test="$side='left'">
  207.        <td valign="top">
  208.          <xsl:choose>
  209.          <xsl:when test="$simple='true'">
  210.            <xsl:call-template name="simpleBody"/>
  211.          </xsl:when>
  212.          <xsl:otherwise>
  213.            <xsl:apply-templates/>
  214.          </xsl:otherwise>
  215.        </xsl:choose>
  216.        </td>
  217.      </xsl:if>
  218.    </tr>
  219.    </table>
  220. </xsl:template>
  221.  
  222. <xsl:template name="linkListContents">
  223.   <xsl:param name="style" select="'toc'"/>
  224.   <xsl:variable name="BaseFile">
  225.    <xsl:value-of select="$masterFile"/>
  226.    <xsl:if test="ancestor::teiCorpus.2">
  227.     <xsl:text>-</xsl:text>
  228.      <xsl:choose>
  229.       <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when> 
  230.       <xsl:otherwise><xsl:number/></xsl:otherwise>
  231.      </xsl:choose>
  232.    </xsl:if>
  233.   </xsl:variable>
  234.  
  235. <xsl:variable name="thisname">
  236.       <xsl:value-of select="name()"/>
  237. </xsl:variable>
  238.  
  239. <a target="_top" class="frametoc" href="{$homeURL}">
  240.   <xsl:value-of select="$homeLabel"/>
  241. </a>
  242. <xsl:call-template name="walkTree">
  243.   <xsl:with-param name="path" select="substring-after($REQUEST,'/')"/>
  244. </xsl:call-template>
  245.  
  246. <xsl:choose>
  247.  <xsl:when test="$thisname='TEI.2' or $thisname=''">
  248. <xsl:for-each select=".//text">
  249.    <xsl:for-each select="front">
  250.     <xsl:if test="div|div0|div1"><hr/></xsl:if>
  251.     <xsl:for-each select="div|div0|div1">
  252.       <xsl:if test="head">
  253.        <xsl:variable name="pointer">
  254.           <xsl:apply-templates mode="xrefheader" select="."/>
  255.        </xsl:variable>
  256.        <p class="{$style}"><a class="{$style}" href="{$pointer}">
  257.        <xsl:call-template name="header"/></a></p>
  258.        <xsl:text>
  259. </xsl:text>
  260. </xsl:if>
  261.     </xsl:for-each>
  262.    </xsl:for-each>
  263.    <xsl:for-each select="body">
  264.     <xsl:if test="div|div0|div1"><hr/></xsl:if>
  265.     <xsl:for-each select="div|div0|div1">
  266.       <xsl:if test="head">
  267.        <xsl:variable name="pointer">
  268.           <xsl:apply-templates mode="xrefheader" select="."/>
  269.        </xsl:variable>
  270.        <p class="{$style}"><a class="{$style}" href="{$pointer}">
  271.          <xsl:call-template name="header"/></a>
  272.        </p><xsl:text>
  273. </xsl:text>
  274.         
  275.       </xsl:if>
  276.     </xsl:for-each>
  277.    </xsl:for-each>
  278.    <xsl:for-each select="back">
  279.     <xsl:for-each select="div|div0|div1">
  280.     <xsl:if test="div|div0|div1"><hr/></xsl:if>
  281.       <xsl:if test="head">
  282.        <xsl:variable name="pointer">
  283.           <xsl:apply-templates mode="xrefheader" select="."/>
  284.        </xsl:variable>
  285.        <p class="{$style}"><a class="{$style}" href="{$pointer}">
  286.        <xsl:call-template name="header"/></a></p>
  287.        <xsl:text>
  288. </xsl:text>
  289. </xsl:if>
  290.     </xsl:for-each>
  291.    </xsl:for-each>
  292.   </xsl:for-each>
  293.  </xsl:when>
  294.  <xsl:otherwise>
  295.     <xsl:text>
  296. </xsl:text><hr/>
  297.  <xsl:for-each select="ancestor::div|ancestor::div2|ancestor::div3|ancestor::div4|ancestor::div5">
  298.    <p class="{$style}"><a class="{$style}">
  299.         <xsl:attribute name="href">
  300.          <xsl:apply-templates mode="xrefheader" select="."/>
  301.         </xsl:attribute>
  302.        <xsl:call-template name="header"/>
  303.      </a></p><xsl:text>
  304. </xsl:text><hr/>
  305.  </xsl:for-each>
  306. <!-- preceding divisions -->
  307.    <xsl:for-each select="preceding-sibling::*[name()=$thisname]">
  308.       <p class="{$style}"><a class="{$style}">
  309.         <xsl:attribute name="href">
  310.          <xsl:apply-templates mode="xrefheader" select="."/>
  311.         </xsl:attribute>
  312.        <xsl:call-template name="header"/>
  313.      </a></p><xsl:text>
  314. </xsl:text>
  315.    </xsl:for-each>
  316.  
  317. <!-- current division -->
  318.       <p class="{$style}"><a class="{$style}-this">
  319.         <xsl:attribute name="href">
  320.          <xsl:apply-templates mode="xrefheader" select="."/>
  321.         </xsl:attribute>
  322.        <xsl:call-template name="header"/>
  323.      </a></p><xsl:text>
  324. </xsl:text>
  325. <!-- ... and any children it has -->
  326.    <xsl:for-each select="div|div2|div3|div4|div5">
  327.       <p class="{$style}-sub"><a class="{$style}-sub">
  328.         <xsl:attribute name="href">
  329.          <xsl:apply-templates mode="xrefheader" select="."/>
  330.         </xsl:attribute>
  331.         <xsl:call-template name="header"/>
  332.        </a></p><xsl:text>
  333. </xsl:text>
  334.    </xsl:for-each>
  335.  
  336. <!-- following divisions -->
  337.    <xsl:for-each select="following-sibling::*[name()=$thisname]">
  338.       <p class="{$style}"><a class="{$style}">
  339.         <xsl:attribute name="href">
  340.          <xsl:apply-templates mode="xrefheader" select="."/>
  341.         </xsl:attribute>
  342.         <xsl:call-template name="header"/>
  343.       </a></p><xsl:text>
  344. </xsl:text>
  345.    </xsl:for-each>
  346.  </xsl:otherwise>
  347. </xsl:choose>
  348. </xsl:template>
  349.  
  350. <xsl:template name="stdfooterFrame">
  351.   <xsl:param name="date"/>
  352.   <xsl:param name="author"/>
  353.   <xsl:param name="style" select="'plain'"/>
  354. <hr/>
  355.   <xsl:variable name="BaseFile">
  356.    <xsl:value-of select="$masterFile"/>
  357.    <xsl:if test="ancestor::teiCorpus.2">
  358.     <xsl:text>-</xsl:text>
  359.      <xsl:choose>
  360.       <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when> 
  361.       <xsl:otherwise><xsl:number/></xsl:otherwise>
  362.      </xsl:choose>
  363.    </xsl:if>
  364.   </xsl:variable>
  365. <xsl:if test="$linkPanel='true'">
  366.  <div class="footer">
  367.  <a  class="{$style}" target="_top">
  368.   <xsl:attribute name="href">
  369.     <xsl:value-of select="concat($BaseFile,$standardSuffix)"/>
  370.     <xsl:text>?makeFrames=false</xsl:text>
  371.   </xsl:attribute>
  372. <xsl:value-of select="$noframeWords"/></a>
  373. <xsl:text> | </xsl:text> 
  374. <a class="{$style}" target="_top">
  375.   <xsl:attribute name="href">
  376.     <xsl:value-of select="concat($BaseFile,$standardSuffix)"/>
  377.     <xsl:text>?style=printable</xsl:text>
  378.   </xsl:attribute>
  379.   <xsl:call-template name="singleFileLabel"/>
  380.  </a> 
  381.  </div>
  382. <hr/>
  383. <div class="footer">
  384. <xsl:if test="$searchURL">
  385.  <a  class="{$style}" target="_top"
  386. href="{$searchURL}"><xsl:call-template name="searchWords"/></a> 
  387. </xsl:if>
  388. <xsl:if test="$feedbackURL">
  389.   <br/><xsl:text>
  390. </xsl:text>
  391.   <br/><xsl:text>
  392. </xsl:text>
  393. <a class="{$style}" target="_top" 
  394. href="{$feedbackURL}"><xsl:call-template name="feedbackWords"/></a> 
  395. </xsl:if>
  396.  </div>
  397.  
  398. </xsl:if>
  399. <xsl:call-template name="preAddress"/>
  400. <address>
  401.  <xsl:comment>
  402. <xsl:text>
  403.   Generated using an XSLT version </xsl:text>
  404. <xsl:value-of select="system-property('xsl:version')"/> stylesheet
  405. based on <xsl:value-of select="$teixslHome"/>teihtml.xsl
  406. processed using: <xsl:value-of select="system-property('xsl:vendor')"/> 
  407. <!-- <xsl:call-template name="whatsTheDate"/> -->
  408. </xsl:comment>
  409. </address>
  410. </xsl:template>
  411.  
  412. <xsl:template name="walkTree">
  413.   <xsl:param name="path"/>
  414.   <xsl:param name="whole" select="''"/>
  415.   <xsl:param name="spacer" select="' >'"/>
  416.   <xsl:choose>
  417.     <xsl:when test="contains($path,'/')">
  418.       <xsl:variable name="current">
  419.         <xsl:value-of select="substring-before($path,'/')"/>            
  420.       </xsl:variable>
  421.      <a class="frametoc" target="_top">
  422.       <xsl:attribute name="href">
  423.         <xsl:value-of select="$whole"/>/<xsl:value-of select="$current"/>
  424.         <xsl:text>/</xsl:text>
  425.       </xsl:attribute>
  426.       <xsl:value-of select="$spacer"/>
  427.       <xsl:value-of select="$current"/>
  428.     </a>
  429.     <xsl:call-template name="walkTree">
  430.        <xsl:with-param name="path" select="substring-after($path,'/')"/>
  431.        <xsl:with-param name="spacer" select="$spacer"/>
  432.        <xsl:with-param name="whole">
  433.          <xsl:value-of select="$whole"/>/<xsl:value-of select="$current"/>
  434.        </xsl:with-param>
  435.     </xsl:call-template>
  436.     </xsl:when>
  437.   </xsl:choose>
  438. </xsl:template>
  439.  
  440. </xsl:stylesheet>
  441.