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

  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.                 xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim"
  4.                 xmlns:xverb="com.nwalsh.xalan.Verbatim"
  5.                 xmlns:lxslt="http://xml.apache.org/xslt"
  6.                 exclude-result-prefixes="sverb xverb lxslt"
  7.                 version='1.0'>
  8.  
  9. <!-- ********************************************************************
  10.      $Id: callout.xsl,v 1.1.2.1 2002/09/04 13:50:12 jdj Exp $
  11.      ********************************************************************
  12.  
  13.      This file is part of the XSL DocBook Stylesheet distribution.
  14.      See ../README or http://nwalsh.com/docbook/xsl/ for copyright
  15.      and other information.
  16.  
  17.      ******************************************************************** -->
  18.  
  19. <lxslt:component prefix="xverb"
  20.                  functions="insertCallouts"/>
  21.  
  22. <xsl:template match="programlistingco|screenco">
  23.   <xsl:variable name="verbatim" select="programlisting|screen"/>
  24.  
  25.   <xsl:choose>
  26.     <xsl:when test="$use.extensions != '0'
  27.                     and $callouts.extension != '0'">
  28.       <xsl:variable name="rtf">
  29.         <xsl:apply-templates select="$verbatim">
  30.           <xsl:with-param name="suppress-numbers" select="'1'"/>
  31.         </xsl:apply-templates>
  32.       </xsl:variable>
  33.  
  34.       <xsl:variable name="rtf-with-callouts">
  35.         <xsl:choose>
  36.           <xsl:when test="function-available('sverb:insertCallouts')">
  37.             <xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/>
  38.           </xsl:when>
  39.           <xsl:when test="function-available('xverb:insertCallouts')">
  40.             <xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/>
  41.           </xsl:when>
  42.           <xsl:otherwise>
  43.             <xsl:message terminate="yes">
  44.               <xsl:text>No insertCallouts function is available.</xsl:text>
  45.             </xsl:message>
  46.           </xsl:otherwise>
  47.         </xsl:choose>
  48.       </xsl:variable>
  49.  
  50.       <xsl:choose>
  51.         <xsl:when test="$verbatim/@linenumbering = 'numbered'
  52.                         and $linenumbering.extension != '0'">
  53.           <div class="{name(.)}">
  54.             <xsl:call-template name="number.rtf.lines">
  55.               <xsl:with-param name="rtf" select="$rtf-with-callouts"/>
  56.               <xsl:with-param name="pi.context"
  57.                               select="programlisting|screen"/>
  58.             </xsl:call-template>
  59.             <xsl:apply-templates select="calloutlist"/>
  60.           </div>
  61.         </xsl:when>
  62.         <xsl:otherwise>
  63.           <div class="{name(.)}">
  64.             <xsl:copy-of select="$rtf-with-callouts"/>
  65.             <xsl:apply-templates select="calloutlist"/>
  66.           </div>
  67.         </xsl:otherwise>
  68.       </xsl:choose>
  69.     </xsl:when>
  70.     <xsl:otherwise>
  71.       <div class="{name(.)}">
  72.         <xsl:apply-templates/>
  73.       </div>
  74.     </xsl:otherwise>
  75.   </xsl:choose>
  76. </xsl:template>
  77.  
  78. <xsl:template match="areaspec|areaset|area">
  79. </xsl:template>
  80.  
  81. <xsl:template match="areaset" mode="conumber">
  82.   <xsl:number count="area|areaset" format="1"/>
  83. </xsl:template>
  84.  
  85. <xsl:template match="area" mode="conumber">
  86.   <xsl:number count="area|areaset" format="1"/>
  87. </xsl:template>
  88.  
  89. <xsl:template match="co">
  90.   <!-- Support a single linkend in HTML -->
  91.   <xsl:variable name="targets" select="key('id', @linkends)"/>
  92.   <xsl:variable name="target" select="$targets[1]"/>
  93.   <xsl:choose>
  94.     <xsl:when test="$target">
  95.       <a>
  96.         <xsl:if test="@id">
  97.           <xsl:attribute name="name">
  98.             <xsl:value-of select="@id"/>
  99.           </xsl:attribute>
  100.         </xsl:if>
  101.         <xsl:attribute name="href">
  102.           <xsl:call-template name="href.target">
  103.             <xsl:with-param name="object" select="$target"/>
  104.           </xsl:call-template>
  105.         </xsl:attribute>
  106.         <xsl:apply-templates select="." mode="callout-bug"/>
  107.       </a>
  108.     </xsl:when>
  109.     <xsl:otherwise>
  110.       <xsl:call-template name="anchor"/>
  111.       <xsl:apply-templates select="." mode="callout-bug"/>
  112.     </xsl:otherwise>
  113.   </xsl:choose>
  114. </xsl:template>
  115.  
  116.  
  117.  
  118.  
  119. <xsl:template match="co" mode="callout-bug">
  120.   <xsl:call-template name="callout-bug">
  121.     <xsl:with-param name="conum">
  122.       <xsl:number count="co" format="1"/>
  123.     </xsl:with-param>
  124.   </xsl:call-template>
  125. </xsl:template>
  126.  
  127. <xsl:template name="callout-bug">
  128.   <xsl:param name="conum" select='1'/>
  129.  
  130.   <xsl:choose>
  131.     <xsl:when test="$callout.graphics != 0
  132.                     and $conum <= $callout.graphics.number.limit">
  133.       <img src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}"
  134.            alt="{$conum}" border="0"/>
  135.     </xsl:when>
  136.     <xsl:when test="$callout.unicode != 0
  137.                     and $conum <= $callout.unicode.number.limit">
  138.       <xsl:choose>
  139.         <xsl:when test="$callout.unicode.start.character = 10102">
  140.           <xsl:choose>
  141.             <xsl:when test="$conum = 1">❶</xsl:when>
  142.             <xsl:when test="$conum = 2">❷</xsl:when>
  143.             <xsl:when test="$conum = 3">❸</xsl:when>
  144.             <xsl:when test="$conum = 4">❹</xsl:when>
  145.             <xsl:when test="$conum = 5">❺</xsl:when>
  146.             <xsl:when test="$conum = 6">❻</xsl:when>
  147.             <xsl:when test="$conum = 7">❼</xsl:when>
  148.             <xsl:when test="$conum = 8">❽</xsl:when>
  149.             <xsl:when test="$conum = 9">❾</xsl:when>
  150.             <xsl:when test="$conum = 10">❿</xsl:when>
  151.           </xsl:choose>
  152.         </xsl:when>
  153.         <xsl:otherwise>
  154.           <xsl:message>
  155.             <xsl:text>Don't know how to generate Unicode callouts </xsl:text>
  156.             <xsl:text>when $callout.unicode.start.character is </xsl:text>
  157.             <xsl:value-of select="$callout.unicode.start.character"/>
  158.           </xsl:message>
  159.           <xsl:text>(</xsl:text>
  160.           <xsl:value-of select="$conum"/>
  161.           <xsl:text>)</xsl:text>
  162.         </xsl:otherwise>
  163.       </xsl:choose>
  164.     </xsl:when>
  165.     <xsl:otherwise>
  166.       <xsl:text>(</xsl:text>
  167.       <xsl:value-of select="$conum"/>
  168.       <xsl:text>)</xsl:text>
  169.     </xsl:otherwise>
  170.   </xsl:choose>
  171. </xsl:template>
  172.  
  173. </xsl:stylesheet>
  174.