home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _7702A967531840C18B08F80C8DF9B0AC < prev    next >
Encoding:
Extensible Markup Language  |  2002-10-21  |  5.4 KB  |  134 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:14 $, $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 gfiles (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. <xsl:stylesheet 
  22.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  23.     xmlns:saxon="http://icl.com/saxon"
  24.     xmlns:exsl="http://exslt.org/common"
  25.     exclude-result-prefixes="saxon exsl" 
  26.     extension-element-prefixes="exsl saxon"
  27.     version="1.1">
  28.  
  29. <xsl:template name="outputChunk">
  30.  <xsl:param name="ident"/>
  31.  <xsl:param name="content"/>
  32.  <xsl:variable name="outName">
  33.  <xsl:choose>
  34.   <xsl:when test="not($outputDir ='')">
  35.     <xsl:value-of select="$outputDir"/>
  36.     <xsl:if test="not(substring($outputDir,string-length($outputDir),string-length($outputDir))='/')">
  37.       <xsl:text>/</xsl:text>
  38.     </xsl:if>
  39.     <xsl:value-of select="concat($ident,'.html')"/>
  40.  </xsl:when>
  41.  <xsl:when test="contains($processor,'SAXON 6')">
  42.    <xsl:variable name="baseName">
  43.     <xsl:value-of 
  44.        xmlns:saxon="http://icl.com/saxon"  
  45.        select="substring-after(saxon:system-id(),':')"/>
  46.    </xsl:variable>
  47.    <xsl:variable name="base">
  48.    <xsl:call-template name="get-basename">
  49.      <xsl:with-param name="file">
  50.       <xsl:value-of select="$baseName"/>
  51.     </xsl:with-param>
  52.    </xsl:call-template>
  53.  </xsl:variable>
  54.  <xsl:value-of 
  55.        xmlns:saxon="http://icl.com/saxon"  
  56.    select="substring-before($baseName,concat($base,'.xml'))"/>
  57.     <xsl:value-of select="concat($ident,'.html')"/>
  58.   </xsl:when>
  59.   <xsl:otherwise>
  60.     <xsl:value-of select="concat($ident,'.html')"/>
  61.   </xsl:otherwise>
  62.   </xsl:choose>
  63.   </xsl:variable>
  64.   <xsl:choose>
  65.   <xsl:when test="$ident=''">
  66.         <xsl:copy-of select="$content"/>     
  67.   </xsl:when>
  68.   <xsl:when test="element-available('exsl:document')">
  69.   <xsl:if test="$verbose='true'">
  70. <xsl:message>Opening <xsl:value-of select="$outName"/> with exsl:document</xsl:message></xsl:if>
  71.       <exsl:document         
  72.         encoding="{$outputEncoding}" 
  73.         method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" href="{$outName}">
  74.         <xsl:copy-of select="$content"/>
  75.       </exsl:document> 
  76. <xsl:if test="$verbose='true'">
  77. <xsl:message>Closing file <xsl:value-of select="$outName"/></xsl:message>
  78. </xsl:if>
  79.     </xsl:when>
  80.   <xsl:when test="element-available('xsl:document')">
  81.   <xsl:if test="$verbose='true'">
  82. <xsl:message>Opening <xsl:value-of select="$outName"/> with xsl:document</xsl:message></xsl:if>
  83.       <xsl:document encoding="{$outputEncoding}" 
  84.                method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" href="{$outName}">
  85.         <xsl:copy-of select="$content"/>
  86.       </xsl:document> 
  87. <xsl:if test="$verbose='true'">
  88. <xsl:message>Closing file <xsl:value-of select="$outName"/></xsl:message>
  89. </xsl:if>
  90.     </xsl:when>
  91.   <xsl:when test="contains($processor,'SAXON 6')">
  92.   <xsl:if test="$verbose='true'"><xsl:message>Opening <xsl:value-of select="$outName"/> with Saxon 6</xsl:message></xsl:if>
  93.       <saxon:output encoding="{$outputEncoding}" 
  94.                method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" file="{$outName}" href="{$outName}">
  95.         <xsl:copy-of select="$content"/>
  96.       </saxon:output> 
  97. <xsl:if test="$verbose='true'">
  98. <xsl:message>Closing file <xsl:value-of select="$outName"/></xsl:message>
  99. </xsl:if>
  100.   </xsl:when>
  101.   <xsl:when test="contains($processor,'SAXON 5')">
  102.   <xsl:if test="$verbose='true'"><xsl:message>Opening <xsl:value-of select="$outName"/> with Saxon 5</xsl:message></xsl:if>
  103.       <saxon:output encoding="{$outputEncoding}" 
  104.                method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" file="{$outName}" href="{$outName}">
  105.         <xsl:copy-of select="$content"/>
  106.       </saxon:output> 
  107. <xsl:if test="$verbose='true'">
  108. <xsl:message>Closing file <xsl:value-of select="$outName"/></xsl:message>
  109. </xsl:if>
  110.   </xsl:when>
  111.   <xsl:when test="contains($processor,'Apache')">
  112.   <xsl:if test="$verbose='true'"><xsl:message>Opening <xsl:value-of select="$outName"/>  with Xalan</xsl:message></xsl:if>
  113.       <xalan:write 
  114.         xsl:extension-element-prefixes="xalan"
  115.         xmlns:xalan="org.apache.xalan.xslt.extensions.Redirect"
  116.         file="{$outName}">
  117.         <xsl:copy-of select="$content"/>
  118.       </xalan:write>
  119. <xsl:if test="$verbose='true'">
  120. <xsl:message>Closing file <xsl:value-of select="$outName"/></xsl:message>
  121. </xsl:if>
  122.   </xsl:when>
  123.   <xsl:otherwise>
  124.       <xsl:if test="$verbose='true'">
  125.       <xsl:message>Creation of <xsl:value-of select="$outName"/> not possible with <xsl:value-of select="$processor"/></xsl:message>
  126.       </xsl:if>
  127.     <xsl:copy-of select="$content"/>
  128.   </xsl:otherwise>
  129.   </xsl:choose>
  130.  
  131. </xsl:template>
  132.  
  133. </xsl:stylesheet>
  134.