home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _A015269A4A24447FB4F9B79E4C8712E5 < prev    next >
Encoding:
Extensible Markup Language  |  2002-10-21  |  4.6 KB  |  128 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- 
  3. TEI XSLT stylesheet family version 1.2
  4. RCS: $Date: 2002/10/21 13:44:12 $, $Revision: 1.1.2.1 $, $Author: jdj $
  5.  
  6. XSL stylesheet to format TEI XML documents to HTML or XSL FO
  7.  
  8.  Copyright 1999-2002 Sebastian Rahtz/Oxford University  <sebastian.rahtz@oucs.ox.ac.uk>
  9.  
  10.  Permission is hereby granted, free of charge, to any person obtaining
  11.  a copy of this software and any associated documentation files (the
  12.  ``Software''), to deal in the Software without restriction, including
  13.  without limitation the rights to use, copy, modify, merge, publish,
  14.  distribute, sublicense, and/or sell copies of the Software, and to
  15.  permit persons to whom the Software is furnished to do so, subject to
  16.  the following conditions:
  17.  
  18.  The above copyright notice and this permission notice shall be included
  19.  in all copies or substantial portions of the Software.
  20. --> 
  21.  
  22. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  23.                 version="1.0">
  24.  
  25. <xsl:template name="generateTitle">
  26.  <xsl:choose>
  27.    <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::TEI.2/text/front//docTitle">
  28.      <xsl:apply-templates 
  29.        select="ancestor-or-self::TEI.2/text/front//docTitle"/>
  30.      </xsl:when>
  31.    <xsl:otherwise>
  32.     <xsl:apply-templates 
  33.       select="ancestor-or-self::TEI.2/teiHeader/fileDesc/titleStmt/title"
  34.       mode="htmlheader"/>
  35.    </xsl:otherwise>
  36. </xsl:choose>
  37. </xsl:template>
  38.  
  39.  
  40. <xsl:template name="generateDate">
  41.   <xsl:param name="showRev">true</xsl:param>
  42. <xsl:variable name="realdate">
  43.  <xsl:choose>
  44.    <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::TEI.2/text/front//docDate">
  45.   <xsl:apply-templates 
  46.     select="ancestor-or-self::TEI.2/text/front//docDate" 
  47.     mode="date"/>
  48.   </xsl:when>
  49.   <xsl:when test="ancestor-or-self::TEI.2/teiHeader/fileDesc/editionStmt/descendant::date">
  50.   <xsl:apply-templates select="ancestor-or-self::TEI.2/teiHeader/fileDesc/editionStmt/descendant::date[1]"/>
  51.     </xsl:when>
  52.   </xsl:choose>
  53. </xsl:variable>
  54.  
  55. <xsl:variable name="revdate">
  56. <xsl:apply-templates 
  57.  select="ancestor-or-self::TEI.2/teiHeader/revisionDesc/descendant::date[1]"/>
  58. </xsl:variable>
  59. <xsl:value-of select="$dateWord"/><xsl:text> </xsl:text>
  60. <xsl:if test="not($realdate = '')">
  61.   <xsl:value-of select="$realdate"/>
  62. </xsl:if>
  63.  
  64.  
  65. <xsl:if test="$showRev='true' and not($revdate = '') and not ($revdate='$Date$')">
  66.  (revised <xsl:choose>
  67.   <xsl:when test="starts-with($revdate,'$Date:')"> <!-- it's RCS -->
  68.     <xsl:value-of select="substring($revdate,16,2)"/>
  69.     <xsl:text>/</xsl:text>
  70.     <xsl:value-of select="substring($revdate,13,2)"/>
  71.     <xsl:text>/</xsl:text>
  72.     <xsl:value-of select="substring($revdate,8,4)"/> 
  73.   </xsl:when>
  74.   <xsl:otherwise>
  75.    <xsl:value-of select="$revdate"/>    
  76.   </xsl:otherwise>
  77.  </xsl:choose>
  78.  <xsl:text>)</xsl:text></xsl:if>
  79.  
  80. </xsl:template>
  81.  
  82. <xsl:template name="generateAuthor">
  83.  <xsl:choose>
  84.    <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::TEI.2/text/front//docAuthor">
  85.      <xsl:apply-templates select="ancestor-or-self::TEI.2/text/front//docAuthor[1]"  mode="author"/>
  86.   </xsl:when>
  87.   <xsl:when test="ancestor-or-self::TEI.2/teiHeader/fileDesc/titleStmt/author">
  88.   <xsl:apply-templates select="ancestor-or-self::TEI.2/teiHeader/fileDesc/titleStmt/author"/>
  89.     </xsl:when>
  90.     <xsl:when test="ancestor-or-self::TEI.2/text/front//docAuthor">
  91.       <xsl:apply-templates select="ancestor-or-self::TEI.2/text/front//docAuthor[1]" mode="author"/>
  92.   </xsl:when>
  93.   </xsl:choose>
  94. </xsl:template>
  95.  
  96. <xsl:template name="generateAuthorList">
  97. <xsl:variable name="realauthor">
  98.   <xsl:call-template name="generateAuthor"/>
  99. </xsl:variable>
  100. <xsl:variable name="revauthor">
  101. <xsl:apply-templates 
  102. select="ancestor-or-self::TEI.2/teiHeader/revisionDesc/change[1]/respStmt/name/text()"/>
  103. </xsl:variable>
  104.  <xsl:value-of select="$authorWord"/><xsl:text> </xsl:text>
  105. <xsl:if test="not($realauthor = '')">
  106.  <xsl:value-of select="$realauthor"/>
  107. </xsl:if>
  108. <xsl:if test="not($revauthor = '') and not(normalize-space($revauthor)='$Author$')">
  109.  (revised <xsl:choose>
  110.   <xsl:when test="starts-with($revauthor,'$Author:')"> <!-- it's RCS -->
  111.     <xsl:value-of 
  112. select="normalize-space(substring-before(substring-after($revauthor,'Author:'),'$'))"/>
  113.   </xsl:when>
  114.   <xsl:otherwise>
  115.    <xsl:value-of select="$revauthor"/>    
  116.   </xsl:otherwise>
  117.  </xsl:choose>
  118.  <xsl:text>)</xsl:text>
  119. </xsl:if>
  120.  
  121. </xsl:template>
  122.  
  123. <xsl:template match="title" mode="htmlheader">
  124.     <xsl:apply-templates/>
  125. </xsl:template>
  126.  
  127. </xsl:stylesheet>
  128.