home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _1FB738E910874124B6AD077B1CC81721 < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-04  |  9.2 KB  |  261 lines

  1. <?xml version="1.0" encoding="US-ASCII"?>
  2. <!--This file was created automatically by html2xhtml-->
  3. <!--from the HTML stylesheets. Do not edit this file.-->
  4. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim" xmlns:xverb="com.nwalsh.xalan.Verbatim" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="sverb xverb lxslt exsl" version="1.0">
  5.  
  6. <!-- ********************************************************************
  7.      $Id: verbatim.xsl,v 1.1.2.3 2002/09/04 13:55:54 jdj Exp $
  8.      ********************************************************************
  9.  
  10.      This file is part of the XSL DocBook Stylesheet distribution.
  11.      See ../README or http://nwalsh.com/docbook/xsl/ for copyright
  12.      and other information.
  13.  
  14.      ******************************************************************** -->
  15.  
  16. <lxslt:component prefix="xverb" functions="numberLines"/>
  17.  
  18. <xsl:template match="programlisting|screen|synopsis">
  19.   <xsl:param name="suppress-numbers" select="'0'"/>
  20.   <xsl:variable name="id">
  21.     <xsl:call-template name="object.id"/>
  22.   </xsl:variable>
  23.  
  24.   <xsl:call-template name="anchor"/>
  25.  
  26.   <xsl:variable name="content">
  27.     <xsl:choose>
  28.       <xsl:when test="$suppress-numbers = '0'                       and @linenumbering = 'numbered'                       and $use.extensions != '0'                       and $linenumbering.extension != '0'">
  29.         <xsl:variable name="rtf">
  30.           <xsl:apply-templates/>
  31.         </xsl:variable>
  32.         <pre xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  33.           <xsl:call-template name="number.rtf.lines">
  34.             <xsl:with-param name="rtf" select="$rtf"/>
  35.           </xsl:call-template>
  36.         </pre>
  37.       </xsl:when>
  38.       <xsl:otherwise>
  39.         <pre xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  40.           <xsl:apply-templates/>
  41.         </pre>
  42.       </xsl:otherwise>
  43.     </xsl:choose>
  44.   </xsl:variable>
  45.  
  46.   <xsl:choose>
  47.     <xsl:when test="$shade.verbatim != 0">
  48.       <table xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="shade.verbatim.style">
  49.         <tr>
  50.           <td>
  51.             <xsl:copy-of select="$content"/>
  52.           </td>
  53.         </tr>
  54.       </table>
  55.     </xsl:when>
  56.     <xsl:otherwise>
  57.       <xsl:copy-of select="$content"/>
  58.     </xsl:otherwise>
  59.   </xsl:choose>
  60. </xsl:template>
  61.  
  62. <xsl:template match="literallayout">
  63.   <xsl:param name="suppress-numbers" select="'0'"/>
  64.  
  65.   <xsl:variable name="rtf">
  66.     <xsl:apply-templates/>
  67.   </xsl:variable>
  68.  
  69.   <xsl:variable name="content">
  70.     <xsl:choose>
  71.       <xsl:when test="$suppress-numbers = '0'                       and @linenumbering = 'numbered'                       and $use.extensions != '0'                       and $linenumbering.extension != '0'">
  72.         <xsl:choose>
  73.           <xsl:when test="@class='monospaced'">
  74.             <pre xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  75.               <xsl:call-template name="number.rtf.lines">
  76.                 <xsl:with-param name="rtf" select="$rtf"/>
  77.               </xsl:call-template>
  78.             </pre>
  79.           </xsl:when>
  80.           <xsl:otherwise>
  81.             <div xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  82.               <p>
  83.                 <xsl:call-template name="number.rtf.lines">
  84.                   <xsl:with-param name="rtf" select="$rtf"/>
  85.                 </xsl:call-template>
  86.               </p>
  87.             </div>
  88.           </xsl:otherwise>
  89.         </xsl:choose>
  90.       </xsl:when>
  91.  
  92.       <xsl:otherwise>
  93.         <xsl:choose>
  94.           <xsl:when test="@class='monospaced'">
  95.             <pre xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  96.               <xsl:copy-of select="$rtf"/>
  97.             </pre>
  98.           </xsl:when>
  99.           <xsl:otherwise>
  100.             <div xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  101.               <p>
  102.                 <xsl:call-template name="make-verbatim">
  103.                   <xsl:with-param name="rtf" select="$rtf"/>
  104.                 </xsl:call-template>
  105.               </p>
  106.             </div>
  107.           </xsl:otherwise>
  108.         </xsl:choose>
  109.       </xsl:otherwise>
  110.     </xsl:choose>
  111.   </xsl:variable>
  112.  
  113.   <xsl:choose>
  114.     <xsl:when test="$shade.verbatim != 0 and @class='monospaced'">
  115.       <table xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="shade.verbatim.style">
  116.         <tr>
  117.           <td>
  118.             <xsl:copy-of select="$content"/>
  119.           </td>
  120.         </tr>
  121.       </table>
  122.     </xsl:when>
  123.     <xsl:otherwise>
  124.       <xsl:copy-of select="$content"/>
  125.     </xsl:otherwise>
  126.   </xsl:choose>
  127. </xsl:template>
  128.  
  129. <xsl:template match="address">
  130.   <xsl:param name="suppress-numbers" select="'0'"/>
  131.  
  132.   <xsl:variable name="rtf">
  133.     <xsl:apply-templates/>
  134.   </xsl:variable>
  135.  
  136.   <xsl:choose>
  137.     <xsl:when test="$suppress-numbers = '0'                     and @linenumbering = 'numbered'                     and $use.extensions != '0'                     and $linenumbering.extension != '0'">
  138.       <div xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  139.         <p>
  140.           <xsl:call-template name="number.rtf.lines">
  141.             <xsl:with-param name="rtf" select="$rtf"/>
  142.           </xsl:call-template>
  143.         </p>
  144.       </div>
  145.     </xsl:when>
  146.  
  147.     <xsl:otherwise>
  148.       <div xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}">
  149.         <p>
  150.           <xsl:call-template name="make-verbatim">
  151.             <xsl:with-param name="rtf" select="$rtf"/>
  152.           </xsl:call-template>
  153.         </p>
  154.       </div>
  155.     </xsl:otherwise>
  156.   </xsl:choose>
  157. </xsl:template>
  158.  
  159. <xsl:template name="number.rtf.lines">
  160.   <xsl:param name="rtf" select="''"/>
  161.   <xsl:param name="pi.context" select="."/>
  162.  
  163.   <!-- Save the global values -->
  164.   <xsl:variable name="global.linenumbering.everyNth" select="$linenumbering.everyNth"/>
  165.  
  166.   <xsl:variable name="global.linenumbering.separator" select="$linenumbering.separator"/>
  167.  
  168.   <xsl:variable name="global.linenumbering.width" select="$linenumbering.width"/>
  169.  
  170.   <!-- Extract the <?dbhtml linenumbering.*?> PI values -->
  171.   <xsl:variable name="pi.linenumbering.everyNth">
  172.     <xsl:call-template name="dbhtml-attribute">
  173.       <xsl:with-param name="pis" select="$pi.context/processing-instruction('dbhtml')"/>
  174.       <xsl:with-param name="attribute" select="'linenumbering.everyNth'"/>
  175.     </xsl:call-template>
  176.   </xsl:variable>
  177.  
  178.   <xsl:variable name="pi.linenumbering.separator">
  179.     <xsl:call-template name="dbhtml-attribute">
  180.       <xsl:with-param name="pis" select="$pi.context/processing-instruction('dbhtml')"/>
  181.       <xsl:with-param name="attribute" select="'linenumbering.separator'"/>
  182.     </xsl:call-template>
  183.   </xsl:variable>
  184.  
  185.   <xsl:variable name="pi.linenumbering.width">
  186.     <xsl:call-template name="dbhtml-attribute">
  187.       <xsl:with-param name="pis" select="$pi.context/processing-instruction('dbhtml')"/>
  188.       <xsl:with-param name="attribute" select="'linenumbering.width'"/>
  189.     </xsl:call-template>
  190.   </xsl:variable>
  191.  
  192.   <!-- Construct the 'in-context' values -->
  193.   <xsl:variable name="linenumbering.everyNth">
  194.     <xsl:choose>
  195.       <xsl:when test="$pi.linenumbering.everyNth != ''">
  196.         <xsl:value-of select="$pi.linenumbering.everyNth"/>
  197.       </xsl:when>
  198.       <xsl:otherwise>
  199.         <xsl:value-of select="$global.linenumbering.everyNth"/>
  200.       </xsl:otherwise>
  201.     </xsl:choose>
  202.   </xsl:variable>
  203.  
  204.   <xsl:variable name="linenumbering.separator">
  205.     <xsl:choose>
  206.       <xsl:when test="$pi.linenumbering.separator != ''">
  207.         <xsl:value-of select="$pi.linenumbering.separator"/>
  208.       </xsl:when>
  209.       <xsl:otherwise>
  210.         <xsl:value-of select="$global.linenumbering.separator"/>
  211.       </xsl:otherwise>
  212.     </xsl:choose>
  213.   </xsl:variable>
  214.  
  215.   <xsl:variable name="linenumbering.width">
  216.     <xsl:choose>
  217.       <xsl:when test="$pi.linenumbering.width != ''">
  218.         <xsl:value-of select="$pi.linenumbering.width"/>
  219.       </xsl:when>
  220.       <xsl:otherwise>
  221.         <xsl:value-of select="$global.linenumbering.width"/>
  222.       </xsl:otherwise>
  223.     </xsl:choose>
  224.   </xsl:variable>
  225.  
  226.   <xsl:choose>
  227.     <xsl:when test="function-available('sverb:numberLines')">
  228.       <xsl:copy-of select="sverb:numberLines($rtf)"/>
  229.     </xsl:when>
  230.     <xsl:when test="function-available('xverb:numberLines')">
  231.       <xsl:copy-of select="xverb:numberLines($rtf)"/>
  232.     </xsl:when>
  233.     <xsl:otherwise>
  234.       <xsl:message terminate="yes">
  235.         <xsl:text>No numberLines function available.</xsl:text>
  236.       </xsl:message>
  237.     </xsl:otherwise>
  238.   </xsl:choose>
  239. </xsl:template>
  240.  
  241. <xsl:template name="make-verbatim">
  242.   <xsl:param name="rtf"/>
  243.  
  244.   <!-- I want to make this RTF verbatim. There are two possibilities: either
  245.        I have access to the exsl:node-set extension function and I can "do it right"
  246.        or I have to rely on CSS. -->
  247.  
  248.   <xsl:choose>
  249.     <xsl:when test="function-available('exsl:node-set')">
  250.       <xsl:apply-templates select="exsl:node-set($rtf)" mode="make.verbatim.mode"/>
  251.     </xsl:when>
  252.     <xsl:otherwise>
  253.       <span xmlns="http://www.w3.org/1999/xhtml" style="white-space: pre;">
  254.         <xsl:copy-of select="$rtf"/>
  255.       </span>
  256.     </xsl:otherwise>
  257.   </xsl:choose>
  258. </xsl:template>
  259.  
  260. </xsl:stylesheet>
  261.