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

  1. <!-- 
  2. TEI XSLT stylesheet family version 1.2
  3. RCS: $Date: 2002/10/21 13:44:21 $, $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. <xsl:stylesheet
  21.   extension-element-prefixes="edate"
  22.   exclude-result-prefixes="edate" 
  23.   xmlns:edate="http://exslt.org/dates-and-times"
  24.   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  25.   version="1.0">
  26.  
  27. <xsl:param name="processor">
  28.    <xsl:value-of select="system-property('xsl:vendor')"/>
  29. </xsl:param>
  30.  
  31. <xsl:param name="STDOUT">
  32.   <xsl:choose>
  33.     <xsl:when test="contains($processor,'Microsoft')">
  34.       <xsl:text>true</xsl:text>
  35.     </xsl:when>
  36.     <xsl:otherwise>false</xsl:otherwise>    
  37.   </xsl:choose>
  38. </xsl:param>
  39.  
  40. <xsl:variable name="masterFile">
  41.  <xsl:choose>
  42.  
  43.  <xsl:when test="not($inputName ='')">
  44.   <xsl:choose>
  45.    <xsl:when test="contains($inputName,'.xml')">
  46.        <xsl:value-of select="substring-before($inputName,'.xml')"/>
  47.    </xsl:when>
  48.    <xsl:otherwise><xsl:value-of select="$inputName"/></xsl:otherwise>
  49.   </xsl:choose>
  50.  </xsl:when>
  51.  
  52.  <xsl:when test="not($REQUEST='')">
  53.    <xsl:call-template name="get-basename">
  54.      <xsl:with-param name="file">
  55.        <xsl:value-of select="$REQUEST"/>
  56.     </xsl:with-param>
  57.    </xsl:call-template>
  58.  </xsl:when>
  59.  
  60.  <xsl:when test="contains($processor,'SAXON')">
  61.    <xsl:call-template name="get-basename">
  62.      <xsl:with-param name="file">
  63.     <xsl:value-of 
  64.        xmlns:saxon="http://icl.com/saxon"  
  65.        select="substring-after(saxon:system-id(),':')"/>
  66.     </xsl:with-param>
  67.    </xsl:call-template>
  68.  </xsl:when>
  69.  
  70.  <xsl:otherwise>index</xsl:otherwise>
  71.  
  72.  </xsl:choose>
  73. </xsl:variable>
  74.  
  75. <xsl:param name="standardSuffix">
  76.   <xsl:choose>
  77.     <xsl:when test="$rawIE='true'">.xml</xsl:when>
  78.     <xsl:when test="$STDOUT='true'"/>
  79.     <xsl:otherwise>.html</xsl:otherwise>
  80.   </xsl:choose>
  81. </xsl:param>
  82.  
  83. <xsl:template name="get-basename">
  84.   <xsl:param name="file"/>
  85.   <xsl:choose>
  86.    <xsl:when test="contains($file,'/')">
  87.     <xsl:call-template name="get-basename">
  88.      <xsl:with-param name="file">
  89.        <xsl:value-of select="substring-after($file,'/')"/>
  90.      </xsl:with-param>
  91.     </xsl:call-template>
  92.   </xsl:when>
  93.   <xsl:otherwise>
  94.   <xsl:choose>
  95.    <xsl:when test="$STDOUT='true'">
  96.      <xsl:value-of select="$file"/>
  97.    </xsl:when>
  98.    <xsl:when test="contains($file,'.xml')">
  99.        <xsl:value-of select="substring-before($file,'.xml')"/>
  100.    </xsl:when>
  101.    <xsl:otherwise><xsl:value-of select="$file"/></xsl:otherwise>
  102.   </xsl:choose>
  103.   </xsl:otherwise>
  104.  </xsl:choose>
  105. </xsl:template>
  106.  
  107. <!-- processors must support `key' -->
  108. <xsl:key name="IDS" match="*[@id]" use="@id"/>
  109.  
  110.  
  111. <xsl:template match="/">
  112. <xsl:if test="contains($processor,'Clark')">
  113. <xsl:message terminate="yes">
  114. XT is not supported by the TEI stylesheets, as it does not implement "key"
  115. </xsl:message>
  116. </xsl:if>
  117. <xsl:choose> 
  118.  
  119.  <xsl:when test="$makePageTable = 'true'">
  120.     <xsl:for-each select="TEI.2">
  121.       <xsl:call-template name="doPageTable">
  122.          <xsl:with-param name="currentID" select="$ID"/>
  123.       </xsl:call-template>
  124.     </xsl:for-each>
  125.     <xsl:if test="not($STDOUT='true')">
  126.       
  127.     <xsl:for-each select="TEI.2/text/front/div">
  128.         <xsl:variable name="currentID">
  129.           <xsl:apply-templates select="." mode="ident"/>
  130.         </xsl:variable>
  131.         <xsl:call-template name="doPageTable">
  132.            <xsl:with-param name="currentID" select="$currentID"/>
  133.         </xsl:call-template>
  134.     </xsl:for-each>
  135.     <xsl:for-each select="TEI.2/text/body/div">
  136.         <xsl:variable name="currentID">
  137.           <xsl:apply-templates select="." mode="ident"/>
  138.         </xsl:variable>
  139.         <xsl:call-template name="doPageTable">
  140.            <xsl:with-param name="currentID" select="$currentID"/>
  141.         </xsl:call-template>
  142.     </xsl:for-each>
  143.     <xsl:for-each select="TEI.2/text/back/div">
  144.         <xsl:variable name="currentID">
  145.           <xsl:apply-templates select="." mode="ident"/>
  146.         </xsl:variable>
  147.         <xsl:call-template name="doPageTable">
  148.            <xsl:with-param name="currentID" select="$currentID"/>
  149.         </xsl:call-template>
  150.     </xsl:for-each>
  151.  
  152.     </xsl:if>
  153.  </xsl:when>
  154.  
  155.  <xsl:when test="not($ID='')">
  156.    <xsl:choose>
  157.      <xsl:when test="$ID='frametoc___'">
  158.             <xsl:call-template name="writeFrameToc"/>
  159.      </xsl:when>
  160.      <xsl:when test="$ID='prelim___'">
  161.        <xsl:apply-templates/>
  162.      </xsl:when>
  163.      <xsl:when test="count(key('IDS',$ID))>0">
  164.        <xsl:for-each select="key('IDS',$ID)">  
  165.           <xsl:call-template name="writeDiv"/>
  166.         </xsl:for-each>
  167.      </xsl:when>
  168.      <xsl:otherwise>
  169.        <!-- the passed iD is a pseudo-XPath expression
  170.             which starts below TEI.2/text.
  171.             The real XPath syntax is changed to avoid problems
  172.             -->
  173.        <xsl:apply-templates select="TEI.2/text" mode="xpath">
  174.          <xsl:with-param name="xpath" select="$ID" />
  175.         </xsl:apply-templates>
  176.       </xsl:otherwise>
  177.    </xsl:choose>
  178.  </xsl:when>
  179.  
  180.  <xsl:when test="$makeFrames='true'">
  181.    <xsl:call-template name="doFrames"/>
  182.  </xsl:when>
  183.  
  184.  <xsl:when test="$makePageTable = 'true'">
  185.     <xsl:for-each select="TEI.2">
  186.       <xsl:call-template name="doPageTable"/>
  187.     </xsl:for-each>
  188.  </xsl:when>
  189.  
  190.  <xsl:when test="$masterFile= '' or $STDOUT='true'">
  191.         <xsl:apply-templates/>
  192.  </xsl:when>
  193.  
  194.  <xsl:when test="$splitLevel=-1">
  195.   <xsl:call-template name="outputChunk">
  196.   <xsl:with-param name="ident">
  197.     <xsl:value-of select="$masterFile"/>
  198.   </xsl:with-param>
  199.   <xsl:with-param name="content">
  200.     <xsl:apply-templates/>
  201.   </xsl:with-param>
  202.   </xsl:call-template>
  203.  </xsl:when>
  204.  <xsl:otherwise>
  205.    <xsl:apply-templates mode="split"/>
  206.  </xsl:otherwise>
  207.  </xsl:choose>
  208. </xsl:template>
  209.  
  210. <!-- *****************************************-->
  211. <xsl:template match="TEI.2">
  212.    <xsl:if test="$verbose='true'">
  213.      <xsl:message>TEI HTML: run start hook template teiStartHook</xsl:message>
  214.    </xsl:if>
  215.    <xsl:call-template name="teiStartHook"/>
  216.    <xsl:if test="$verbose='true'">
  217.      <xsl:message>TEI HTML in single document mode </xsl:message>
  218.    </xsl:if>
  219.    <html><xsl:call-template name="addLangAtt"/> 
  220.    <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. 
  221.    DO NOT EDIT</xsl:comment>
  222.    <head>
  223.      <xsl:variable name="pagetitle">
  224.        <xsl:call-template name="generateTitle"/>
  225.      </xsl:variable>
  226.      <title><xsl:value-of select="$pagetitle"/></title>
  227.    <xsl:call-template name="headHook"/>
  228.    <xsl:if test="not($cssFile = '')">
  229.     <link rel="stylesheet" type="text/css" href="{$cssFile}"/>
  230.    </xsl:if>
  231.    <xsl:call-template name="metaHook">
  232.      <xsl:with-param name="title" select="$pagetitle"/>
  233.    </xsl:call-template>
  234.    <xsl:call-template name="javaScript"/>
  235.    </head>
  236.    <body>
  237.    <xsl:call-template name="bodyHook"/>
  238.    <xsl:call-template name="bodyJavaScript"/>
  239.    <a name="TOP"/>
  240.    <xsl:call-template name="stdheader">
  241.      <xsl:with-param name="title">
  242.        <xsl:call-template name="generateTitle"/>
  243.      </xsl:with-param>
  244.    </xsl:call-template>
  245.    <xsl:call-template name="startHook"/>
  246.    <xsl:choose>
  247.    <xsl:when test="$leftLinks">
  248.     <xsl:call-template name="linkList">
  249.          <xsl:with-param name="side" select="'left'"/>
  250.          <xsl:with-param name="simple" select="'true'"/>
  251.     </xsl:call-template>
  252.    </xsl:when>
  253.    <xsl:when test="$rightLinks">
  254.     <xsl:call-template name="linkList">
  255.          <xsl:with-param name="side" select="'right'"/>
  256.          <xsl:with-param name="simple" select="'true'"/>
  257.     </xsl:call-template>
  258.    </xsl:when>
  259.    <xsl:otherwise>
  260.      <xsl:call-template name="simpleBody"/>
  261.    </xsl:otherwise>
  262.   </xsl:choose>
  263.  
  264.  <xsl:call-template name="stdfooter">
  265.        <xsl:with-param name="date">
  266.          <xsl:call-template name="generateDate"/>
  267.        </xsl:with-param>
  268.        <xsl:with-param name="author">
  269.          <xsl:call-template name="generateAuthorList"/>
  270.        </xsl:with-param>
  271.  </xsl:call-template>
  272.  </body>
  273.  </html>
  274. <xsl:if test="$verbose='true'">
  275.  <xsl:message>TEI HTML: run end hook template teiEndHook</xsl:message>
  276. </xsl:if>
  277.   <xsl:call-template name="teiEndHook"/>
  278. </xsl:template>
  279.  
  280. <!-- *****************************************-->
  281.  
  282. <xsl:template match="TEI.2" mode="split">
  283. <xsl:variable name="BaseFile">
  284.   <xsl:value-of select="$masterFile"/>
  285.   <xsl:if test="ancestor::teiCorpus.2">
  286.     <xsl:text>-</xsl:text>
  287.      <xsl:choose>
  288.       <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when> 
  289.       <xsl:otherwise><xsl:number/></xsl:otherwise>
  290.      </xsl:choose>
  291.   </xsl:if>
  292. </xsl:variable>
  293. <xsl:if test="$verbose='true'">
  294.  <xsl:message>TEI HTML: run start hook template teiStartHook</xsl:message>
  295. </xsl:if>
  296.   <xsl:call-template name="teiStartHook"/>
  297. <xsl:if test="$verbose='true'">
  298.   <xsl:message>TEI HTML in splitting mode, base file is <xsl:value-of select="$BaseFile"/> </xsl:message>
  299. </xsl:if>
  300.   <xsl:call-template name="outputChunk">
  301.   <xsl:with-param name="ident">
  302.     <xsl:value-of select="$BaseFile"/>
  303.   </xsl:with-param>
  304.   <xsl:with-param name="content">
  305.     <xsl:call-template name="writeMain"/>
  306.   </xsl:with-param>
  307.   </xsl:call-template>
  308. <xsl:if test="$verbose='true'">
  309.  <xsl:message>TEI HTML: run end hook template teiEndHook</xsl:message>
  310. </xsl:if>
  311.   <xsl:call-template name="teiEndHook"/>
  312.  
  313. </xsl:template>
  314.  
  315. <!-- *****************************************-->
  316.  
  317. <xsl:template name="writeMain">
  318.  <html><xsl:call-template name="addLangAtt"/> 
  319.  <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. 
  320.  DO NOT EDIT ME</xsl:comment>
  321.      <xsl:variable name="pagetitle">
  322.        <xsl:call-template name="generateTitle"/>
  323.      </xsl:variable>
  324.  <head>
  325.  <title><xsl:value-of select="$pagetitle"/></title>
  326.  <xsl:if test="not($cssFile = '')">
  327.  <xsl:call-template name="headHook"/>
  328.   <link rel="stylesheet" type="text/css" href="{$cssFile}"/>
  329.  </xsl:if>
  330.  <xsl:if test="$makeFrames='true'">
  331.    <base target="framemain"/>
  332.  </xsl:if>
  333.  <xsl:call-template name="metaHook">
  334.      <xsl:with-param name="title" select="$pagetitle"/>
  335.  </xsl:call-template>
  336.  <xsl:call-template name="javaScript"/>
  337.  </head>
  338.   <body>
  339.     <xsl:call-template name="bodyHook"/>
  340.     <xsl:call-template name="bodyJavaScript"/>
  341.     <a name="TOP"/>
  342.     <xsl:call-template name="stdheader">
  343.       <xsl:with-param name="title">
  344.         <xsl:call-template name="generateTitle"/>
  345.       </xsl:with-param>
  346.     </xsl:call-template>
  347.     
  348.     <xsl:call-template name="mainbody"/>
  349.     
  350.     <!-- notes -->
  351.     <xsl:call-template name="printNotes"/>
  352.  
  353.     <xsl:call-template name="topNavigation"/>
  354.  
  355.     <xsl:call-template name="stdfooter">
  356.      <xsl:with-param name="date">
  357.        <xsl:call-template name="generateDate"/>
  358.      </xsl:with-param>
  359.      <xsl:with-param name="author">
  360.        <xsl:call-template name="generateAuthorList"/>
  361.      </xsl:with-param>
  362.     </xsl:call-template>
  363.   </body>
  364.  </html>
  365. </xsl:template>
  366.  
  367. <!-- *****************************************-->
  368.  
  369. <xsl:template name="mainbody">
  370.   <xsl:comment> front matter </xsl:comment>
  371.  <xsl:apply-templates select="text/front"/>
  372.  
  373.  <xsl:if test="$autoToc='true' and (descendant::div or descendant::div0 or descendant::div1) and not(descendant::divGen[@type='toc'])">
  374.    <h2><xsl:value-of select="$tocWords"/></h2>
  375.    <xsl:call-template name="maintoc"/>
  376.  </xsl:if>
  377.  <xsl:choose>
  378.  <xsl:when test="text/group">
  379.   <xsl:apply-templates select="text/group"/>
  380.  </xsl:when>
  381.  <xsl:otherwise>
  382.  
  383.  <xsl:comment>body matter </xsl:comment>
  384.  
  385.  <xsl:call-template name="startHook"/>
  386.  <xsl:call-template name="doBody"/>
  387.  
  388.  </xsl:otherwise>
  389.  </xsl:choose>
  390.  
  391.   <xsl:comment>back matter </xsl:comment>
  392.  <xsl:apply-templates select="text/back"/>
  393.  
  394. </xsl:template>
  395.  
  396.  
  397. <xsl:template name="simpleBody">
  398. <!-- front matter -->
  399.   <xsl:apply-templates select="text/front"/>
  400.  
  401.  <xsl:if test="$autoToc='true' and (descendant::div or descendant::div0 or descendant::div1) and not(descendant::divGen[@type='toc'])">
  402.    <h2><xsl:value-of select="$tocWords"/></h2>
  403.    <xsl:call-template name="maintoc"/>
  404.  </xsl:if>
  405.  
  406.  <!-- main text -->
  407.  <xsl:choose>
  408.  <xsl:when test="text/group">
  409.   <xsl:apply-templates select="text/group"/>
  410.  </xsl:when>
  411.  <xsl:otherwise>
  412.   <xsl:apply-templates select="text/body"/>
  413.  </xsl:otherwise>
  414.  </xsl:choose>
  415.  
  416.  <!-- back matter -->
  417.  <xsl:apply-templates select="text/back"/>
  418.  
  419.  <xsl:call-template name="printNotes"/>
  420.  
  421. </xsl:template>
  422.  
  423. <xsl:template name="teiStartHook"/>
  424.  
  425. <xsl:template name="teiEndHook"/>
  426.  
  427.  
  428. <xsl:template name="stdheader">
  429.   <xsl:param name="title" select="'(no title)'"/>
  430. <xsl:choose>
  431.  <xsl:when test="$makeFrames='true'">
  432.      <h2 class="maintitle"><xsl:call-template name="generateTitle"/></h2>
  433.      <h1 class="maintitle"><xsl:value-of select="$title"/></h1>
  434.       <xsl:if test="$showTitleAuthor='true'">
  435.        <xsl:if test="$verbose='true'">
  436.           <xsl:message>displaying author and date</xsl:message>
  437.        </xsl:if>
  438.        <xsl:call-template name="generateAuthorList"/>
  439.        <xsl:text> </xsl:text>
  440.        <xsl:call-template name="generateDate"/>
  441.       </xsl:if>
  442.  </xsl:when>
  443.  <xsl:otherwise>
  444.  <table class="header" width="100%">
  445.  <tr><td rowspan="3"><xsl:call-template name="logoPicture"/></td>
  446.     <td align="left">
  447.       <h2 class="institution"><xsl:value-of select="$institution"/></h2>
  448.     </td></tr>
  449.     <xsl:if test="not($department = '')">
  450.      <tr><td align="left">
  451.       <h2 class="department"><xsl:value-of select="$department"/></h2>
  452.      </td>
  453.      </tr>
  454.     </xsl:if>
  455.     <tr><td align="left">
  456.       <xsl:call-template name="generateSubTitle"/>
  457.       <h1 class="maintitle"><xsl:value-of select="$title"/></h1>
  458.     </td></tr>
  459.     <xsl:if test="$showTitleAuthor='true'">
  460.       <xsl:if test="$verbose='true'">
  461.        <xsl:message>displaying author and date</xsl:message>
  462.       </xsl:if>
  463.       <tr><td> </td><td  align="left">
  464.         <xsl:call-template name="generateAuthorList"/>
  465.       <xsl:text> </xsl:text>
  466.       <xsl:call-template name="generateDate"/>
  467.       </td></tr>
  468.     </xsl:if>
  469.  </table>
  470. </xsl:otherwise>
  471. </xsl:choose>
  472.  <hr/>
  473. </xsl:template>
  474.  
  475.  
  476. <xsl:template name="stdfooter">
  477.   <xsl:param name="date"/>
  478.   <xsl:param name="author"/>
  479.   <xsl:param name="style" select="'plain'"/>
  480. <hr/>
  481. <xsl:if test="$linkPanel='true' and not($makeFrames='true')">
  482.  <div class="footer">
  483. <a class="{$style}" target="_top" 
  484. href="{$parentURL}"><xsl:value-of select="$parentWords"/></a>
  485. | <a  class="{$style}" target="_top" 
  486. href="{$homeURL}"><xsl:value-of select="$homeWords"/></a> 
  487. <xsl:if test="$searchURL">
  488. | <a class="{$style}" target="_top" 
  489. href="{$searchURL}"><xsl:call-template name="searchWords"/></a> 
  490. </xsl:if>
  491. <xsl:if test="$searchURL">
  492. | <a  class="{$style}" target="_top"
  493. href="{$feedbackURL}"><xsl:call-template name="feedbackWords"/></a> 
  494. </xsl:if>
  495.  </div>
  496.  <hr/>
  497. </xsl:if>
  498. <xsl:call-template name="preAddress"/>
  499. <address>
  500.  <xsl:value-of select="$date"/>
  501.  <xsl:if test="not($author='')">
  502.     <xsl:value-of select="$author"/>
  503.  </xsl:if>.
  504.  <br/>
  505.  <xsl:call-template name="copyrightStatement"/>
  506.  <xsl:comment><xsl:text>
  507. Generated </xsl:text>
  508.  <xsl:if test="not($masterFile='index')">
  509.    <xsl:text>from </xsl:text>
  510.    <xsl:value-of select="$masterFile"/>
  511. </xsl:if>
  512. <xsl:text> using an XSLT version </xsl:text>
  513. <xsl:value-of select="system-property('xsl:version')"/> stylesheet
  514. based on <xsl:value-of select="$teixslHome"/>teihtml.xsl
  515. processed using <xsl:value-of select="system-property('xsl:vendor')"/>
  516. <xsl:call-template name="whatsTheDate"/>
  517. </xsl:comment>
  518. </address>
  519. </xsl:template>
  520.  
  521.  
  522.  
  523. <xsl:template name="whatsTheDate">
  524.  <xsl:text> on </xsl:text>
  525.  <xsl:choose>
  526.  <xsl:when test="function-available('edate:date-time')">
  527.   <xsl:value-of select="edate:date-time()"/>
  528.  </xsl:when>
  529.  <xsl:when test="contains($processor,'SAXON')">
  530.    <xsl:value-of 
  531.      xmlns:Date="/java.util.Date" 
  532.      select="Date:toString(Date:new())"/>
  533.  </xsl:when>
  534.  <xsl:otherwise>
  535.    (unknown)
  536.   </xsl:otherwise>
  537.  </xsl:choose>
  538. </xsl:template>
  539.  
  540. <xsl:template name="topNavigation">
  541. <xsl:if test="ancestor::teiCorpus.2">
  542. <p align="{$alignNavigationPanel}">
  543.   <xsl:call-template name="nextLink">
  544.    <xsl:with-param name="next" select="following-sibling::TEI.2[1]"/>
  545.   </xsl:call-template>
  546.  
  547.   <xsl:call-template name="previousLink">
  548.    <xsl:with-param name="previous" select="preceding-sibling::TEI.2[1]"/>
  549.   </xsl:call-template>
  550.  
  551.   <xsl:call-template name="upLink">
  552.         <xsl:with-param name="h" select="concat($masterFile,$standardSuffix)"/>
  553.         <xsl:with-param name="u">
  554.           <xsl:call-template name="contentsWord"/>
  555.         </xsl:with-param>
  556.   </xsl:call-template>
  557. </p>
  558. </xsl:if>
  559. </xsl:template>
  560.  
  561.  
  562. <xsl:template name="doBody">
  563. <xsl:param name="Head"/>
  564. <xsl:variable name="ident">
  565.    <xsl:apply-templates select="." mode="ident"/>
  566. </xsl:variable>
  567.  <xsl:choose>
  568.   <xsl:when test="$leftLinks">
  569.     <xsl:call-template name="linkList">
  570.          <xsl:with-param name="side" select="'left'"/>
  571.     </xsl:call-template>
  572.   </xsl:when>
  573.   <xsl:when test="$rightLinks">
  574.     <xsl:call-template name="linkList">
  575.          <xsl:with-param name="side" select="'right'"/>
  576.     </xsl:call-template>
  577.   </xsl:when>
  578.   <xsl:when test="parent::div/@rend='multicol'">
  579.      <td valign="top">
  580.       <xsl:if test="not($Head = '')">
  581.        <xsl:element name="h{$Head + $divOffset}">
  582.         <a name="{$ident}"></a><xsl:call-template name="header"/>
  583.        </xsl:element>
  584.       </xsl:if>
  585.       <xsl:apply-templates  select="text/body"/>
  586.      </td>
  587.   </xsl:when>
  588.   <xsl:when test="@rend='multicol'">
  589.    <table>
  590.    <tr>
  591.      <xsl:apply-templates select="text/body"/>
  592.    </tr>
  593.    </table>
  594.   </xsl:when>
  595.   <xsl:otherwise>
  596.       <xsl:if test="not($Head = '')">
  597.        <xsl:element name="h{$Head + $divOffset}">
  598.         <a name="{$ident}"></a><xsl:call-template name="header"/>
  599.        </xsl:element>
  600.       </xsl:if>
  601.    <xsl:apply-templates select="text/body"/>
  602.   </xsl:otherwise>
  603.  </xsl:choose>
  604. </xsl:template>
  605.  
  606. <xsl:template match="processing-instruction()[name()='xmltex']" >
  607.    <xsl:value-of select="."/>
  608. </xsl:template>
  609.  
  610. <!-- This nice bit of code is from Jeni Tennison -->
  611. <xsl:template match="*" mode="xpath">
  612.   <xsl:param name="xpath" />
  613.   <xsl:param name="action" />
  614.   <xsl:choose>
  615.     <!-- if there is a path -->
  616.     <xsl:when test="$xpath">
  617.       <!-- step is the part before the '_' (if there is one) -->
  618.       <xsl:variable name="step">
  619.         <xsl:choose>
  620.           <xsl:when test="contains($xpath, '_')">
  621.             <xsl:value-of select="substring-before($xpath, '_')" />
  622.           </xsl:when>
  623.           <xsl:otherwise>
  624.             <xsl:value-of select="$xpath" />
  625.           </xsl:otherwise>
  626.         </xsl:choose>
  627.       </xsl:variable>
  628.       <!-- the child's name is the part before the '.' -->
  629.       <xsl:variable name="childName"
  630.                     select="substring-before($step, '.')" />
  631.       <!-- and its index is the part after '.' -->
  632.       <xsl:variable name="childIndex"
  633.         select="substring-after($step, '.')"/>
  634.       <!-- so apply templates to that child, passing in the $xpath
  635.            left after the first step -->
  636.       <xsl:apply-templates select="*[name() = $childName]
  637.                                     [number($childIndex)]" mode="xpath">
  638.          <xsl:with-param name="xpath"
  639.                          select="substring-after($xpath, '_')" />
  640.          <xsl:with-param name="action"
  641.                          select="$action" />
  642.       </xsl:apply-templates>
  643.     </xsl:when>
  644.     <!-- if there's no path left, then this is the element we want -->
  645.     <xsl:otherwise>
  646.       <xsl:choose>
  647.         <xsl:when test="$action='header'">
  648.               <xsl:apply-templates select="." mode="header"/>
  649.         </xsl:when>
  650.         <xsl:when test="$action='toclist'">
  651.          <xsl:call-template name="linkListContents">
  652.            <xsl:with-param name="style" select="'frametoc'"/>
  653.          </xsl:call-template>
  654.         </xsl:when>
  655.         <xsl:when test="name()='div' and $makeFrames='true'">
  656.           <xsl:call-template name="writeDiv"/>
  657.         </xsl:when>
  658.         <xsl:when test="name()='div' and $makePageTable='true'">
  659.           <h2><xsl:apply-templates select="." mode="header"/></h2>
  660.           <xsl:call-template name="doDivBody"/>
  661.                 <xsl:if test="$bottomNavigationPanel='true'">
  662.                  <xsl:call-template name="xrefpanel">
  663.                   <xsl:with-param name="homepage" 
  664.                    select="concat($masterFile,$standardSuffix)"/>
  665.                   <xsl:with-param name="mode" select="name(.)"/>
  666.                  </xsl:call-template>
  667.                 </xsl:if>
  668.         </xsl:when>
  669.         <xsl:when test="self::divGen[@type='summary']">
  670.            <xsl:call-template name="summaryToc"/>
  671.         </xsl:when>
  672.       </xsl:choose>
  673.     </xsl:otherwise>
  674.   </xsl:choose>
  675. </xsl:template>
  676.  
  677. <xsl:template name="summaryToc">
  678.          <div  class="teidiv">
  679.   <p>Select headings on the left-hand side to see  
  680.  more explanation of the links on the right.</p>
  681.  <table  cellspacing="7">
  682.   <thead><th nowrap="nowrap"/><th/></thead>
  683.   <xsl:for-each select="//body/div">
  684. <xsl:text>
  685. </xsl:text> 
  686.    <tr class="summaryline">
  687.     <td class="summarycell" valign="top" align="right">
  688.     <b><a class="nolink" targe="_top">
  689.     <xsl:attribute name="href">
  690.             <xsl:apply-templates mode="xrefheader" select="."/>
  691.     </xsl:attribute>
  692.     <xsl:value-of select="head"/></a></b>
  693.     </td>
  694.     <td  class="link" valign="top" >
  695.        <xsl:for-each select=".//xref|.//xptr">
  696.        <xsl:if test="position() > 1">
  697.            <xsl:text> </xsl:text>
  698.            <img src="/images/dbluball.gif"/>
  699.            <xsl:text> </xsl:text>
  700.     </xsl:if>
  701.         <span class="nowrap"><xsl:apply-templates select="."/></span>
  702.        </xsl:for-each>
  703.     </td>
  704.    </tr>
  705.   </xsl:for-each>
  706.  </table>
  707.         </div>
  708.  </xsl:template>
  709.  
  710. <xsl:template name="generateSubTitle"/>
  711.  
  712. <xsl:template name="metaHook">
  713.   <xsl:param name="title"/>
  714.  <meta name="author">
  715.    <xsl:attribute name="content">
  716.      <xsl:call-template name="generateAuthor"/>
  717.    </xsl:attribute>
  718.  </meta>
  719.  <meta name="generator" content="TEI XSLT stylesheets"/>
  720.  <meta name="DC.Title" content="{$title}"/>
  721.  <meta name="DC.Type" content="Text"/>
  722.  <meta name="DC.Format" content="text/html"/>
  723. </xsl:template>
  724.  
  725. <xsl:template name="javaScript">
  726.   <xsl:if test="$rawIE='true'">
  727.   <xsl:text>
  728. </xsl:text>
  729.  <script language="javascript">
  730.    <xsl:comment>
  731. <![CDATA[
  732. function makeitsoyoubastard(hash){
  733.         alert("Fragment "+hash);
  734.     var as = document.all.tags("A");
  735.     for (var i=0; i < as.length; i++){
  736.         if (as[i].name == hash) as[i].scrollIntoView(true);
  737.     }
  738. }]]>
  739. function gotoSection(frag,section){
  740.    var s = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
  741.    var x = document.XMLDocument;
  742.    if (x == null){
  743.     x = navigator.XMLDocument;
  744.     s = navigator.XSLDocument;
  745.    }else{
  746.      s.async = false;
  747.      s.load(document.XSLDocument.url);
  748.      x.load(document.XMLDocument.url);
  749.    }
  750.     var tem = new ActiveXObject("MSXML2.XSLTemplate"); 
  751.     tem.stylesheet = s; 
  752.     var proc = tem.createProcessor();
  753.     proc.addParameter("ID", section);
  754.     proc.input = x;
  755.     proc.transform();
  756.     var str = proc.output;
  757.     var newDoc = document.open("text/html", "replace");
  758.     newDoc.write(str);
  759.     newDoc.close();
  760.     navigator.XMLDocument = x;
  761.     navigator.XSLDocument = s;
  762.     if (frag == '') {}  else { 
  763.     makeitsoyoubastard(frag); 
  764.   }
  765. }
  766.      <xsl:text>
  767.        //
  768. </xsl:text>
  769.    </xsl:comment>
  770.  </script>
  771.  </xsl:if>
  772. </xsl:template>
  773.  
  774. </xsl:stylesheet>
  775.