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

  1. <!-- 
  2. TEI XSLT stylesheet family version 1.2
  3. RCS: $Date: 2002/10/21 13:44:17 $, $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.   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  22.   version="1.0">
  23. <xsl:template match="figure" mode="header">
  24. <xsl:if test="head">
  25.   <p>
  26.   <xsl:if test="$numberFigures">
  27.      Figure <xsl:number level="any"/>.<xsl:text> </xsl:text>
  28.   </xsl:if>
  29.   <xsl:apply-templates select="head"/></p>
  30. </xsl:if>
  31. </xsl:template>
  32.  
  33. <xsl:template match="figure">
  34.  
  35.  <xsl:variable name="File">
  36.   <xsl:choose> 
  37.   <xsl:when test="@file">
  38.    <xsl:value-of select="@file"/>
  39.    <xsl:if test="not(contains(@file,'.'))">
  40.       <xsl:value-of select="$graphicsSuffix"/>
  41.    </xsl:if>
  42.   </xsl:when>
  43.   <xsl:when test="@url">
  44.    <xsl:value-of select="@url"/>
  45.    <xsl:if test="not(contains(@url,'.'))">
  46.       <xsl:value-of select="$graphicsSuffix"/>
  47.    </xsl:if>
  48.   </xsl:when>
  49.   <xsl:otherwise>
  50.     <xsl:variable name="entity">
  51.       <xsl:value-of select="unparsed-entity-uri(@entity)"/>
  52.     </xsl:variable>
  53.     <xsl:choose>
  54.       <xsl:when test="starts-with($entity,'file:')">
  55.         <xsl:value-of select="substring-after($entity,'file:')"/>
  56.       </xsl:when>
  57.       <xsl:otherwise>
  58.         <xsl:value-of select="$entity"/>
  59.       </xsl:otherwise>
  60.     </xsl:choose>
  61.   </xsl:otherwise>
  62.   </xsl:choose>
  63.  </xsl:variable>
  64.  
  65. <xsl:if test="@id">
  66.      <a name="{@id}"/>
  67. </xsl:if>
  68. <xsl:choose>
  69.   <xsl:when test="$showFigures='true'">
  70.   <img src="{$graphicsPrefix}{$File}">
  71.     <xsl:if test="@id">
  72.       <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
  73.     </xsl:if>
  74.    <xsl:if test="string-length(@rend) >0">
  75.     <xsl:attribute name="class"><xsl:value-of select="@rend"/></xsl:attribute>
  76.    </xsl:if>
  77.    <xsl:if test="@rend='inline'">
  78.     <xsl:attribute name="border">0</xsl:attribute>
  79.    </xsl:if>
  80.    <xsl:if test="@width and not(contains(@width,'in'))">
  81.     <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
  82.    </xsl:if>
  83.    <xsl:if test="@height and not(contains(@height,'in'))">
  84.     <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
  85.    </xsl:if>
  86.    <xsl:attribute name="alt">
  87.    <xsl:choose>
  88.    <xsl:when test="figDesc">
  89.         <xsl:value-of select="figDesc/text()"/>
  90.    </xsl:when>
  91.     <xsl:otherwise>
  92.         <xsl:value-of select="head/text()"/>
  93.     </xsl:otherwise>
  94.      </xsl:choose>
  95.      </xsl:attribute>
  96.    <xsl:call-template name="imgHook"/>
  97.  </img>
  98.  </xsl:when>
  99.  <xsl:otherwise>
  100.    <hr/>
  101.    <p>Figure <xsl:number level="any"/>
  102.     file <xsl:value-of select="$File"/>
  103.  <xsl:if test="figDesc">
  104.   [<xsl:apply-templates select="figDesc/text()"/>]
  105.  </xsl:if>
  106.    </p>
  107.    <hr/>
  108.   </xsl:otherwise>
  109.   </xsl:choose>
  110.   <xsl:if test="head"><p>
  111.   <xsl:if test="$numberFigures" >
  112.     Figure <xsl:number level="any"/>.<xsl:text> </xsl:text>
  113.   </xsl:if>
  114.   <xsl:apply-templates select="head"/>
  115.    </p>
  116.    </xsl:if>
  117. </xsl:template>
  118.  
  119. <xsl:template name="imgHook"/>
  120.  
  121. <xsl:template match="figDesc"/>
  122.  
  123. </xsl:stylesheet>
  124.