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$ 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 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/> 25 26 <xsl:choose> 27 <xsl:when test="$use.extensions != '0' 28 and $callouts.extension != '0'"> 29 <xsl:variable name="rtf"> 30 <xsl:apply-templates select="$verbatim"> 31 <xsl:with-param name="suppress-numbers" select="'1'"/> 32 </xsl:apply-templates> 33 </xsl:variable> 34 35 <xsl:variable name="rtf-with-callouts"> 36 <xsl:choose> 37 <xsl:when test="contains($vendor, 'SAXON ')"> 38 <xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/> 39 </xsl:when> 40 <xsl:when test="contains($vendor, 'Apache Software Foundation')"> 41 <xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/> 42 </xsl:when> 43 <xsl:otherwise> 44 <xsl:message terminate="yes"> 45 <xsl:text>Don't know how to do callouts with </xsl:text> 46 <xsl:value-of select="$vendor"/> 47 </xsl:message> 48 </xsl:otherwise> 49 </xsl:choose> 50 </xsl:variable> 51 52 <xsl:choose> 53 <xsl:when test="$verbatim/@linenumbering = 'numbered' 54 and $linenumbering.extension != '0'"> 55 <div class="{name(.)}"> 56 <xsl:call-template name="number.rtf.lines"> 57 <xsl:with-param name="rtf" select="$rtf-with-callouts"/> 58 <xsl:with-param name="pi.context" 59 select="programlisting|screen"/> 60 </xsl:call-template> 61 <xsl:apply-templates select="calloutlist"/> 62 </div> 63 </xsl:when> 64 <xsl:otherwise> 65 <div class="{name(.)}"> 66 <xsl:copy-of select="$rtf-with-callouts"/> 67 <xsl:apply-templates select="calloutlist"/> 68 </div> 69 </xsl:otherwise> 70 </xsl:choose> 71 </xsl:when> 72 <xsl:otherwise> 73 <div class="{name(.)}"> 74 <xsl:apply-templates/> 75 </div> 76 </xsl:otherwise> 77 </xsl:choose> 78</xsl:template> 79 80<xsl:template match="areaspec|areaset|area"> 81</xsl:template> 82 83<xsl:template match="areaset" mode="conumber"> 84 <xsl:number count="area|areaset" format="1"/> 85</xsl:template> 86 87<xsl:template match="area" mode="conumber"> 88 <xsl:number count="area|areaset" format="1"/> 89</xsl:template> 90 91<xsl:template match="co"> 92 <a name="{@id}"/> 93 <xsl:apply-templates select="." mode="callout-bug"/> 94</xsl:template> 95 96<xsl:template match="co" mode="callout-bug"> 97 <xsl:call-template name="callout-bug"> 98 <xsl:with-param name="conum"> 99 <xsl:number count="co" format="1"/> 100 </xsl:with-param> 101 </xsl:call-template> 102</xsl:template> 103 104<xsl:template name="callout-bug"> 105 <xsl:param name="conum" select='1'/> 106 107 <xsl:choose> 108 <xsl:when test="$callout.graphics != 0 109 and $conum <= $callout.graphics.number.limit"> 110 <img src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}" 111 alt="{$conum}" border="0"/> 112 </xsl:when> 113 <xsl:when test="$callout.unicode != 0 114 and $conum <= $callout.unicode.number.limit"> 115 <xsl:choose> 116 <xsl:when test="$callout.unicode.start.character = 10102"> 117 <xsl:choose> 118 <xsl:when test="$conum = 1">❶</xsl:when> 119 <xsl:when test="$conum = 2">❷</xsl:when> 120 <xsl:when test="$conum = 3">❸</xsl:when> 121 <xsl:when test="$conum = 4">❹</xsl:when> 122 <xsl:when test="$conum = 5">❺</xsl:when> 123 <xsl:when test="$conum = 6">❻</xsl:when> 124 <xsl:when test="$conum = 7">❼</xsl:when> 125 <xsl:when test="$conum = 8">❽</xsl:when> 126 <xsl:when test="$conum = 9">❾</xsl:when> 127 <xsl:when test="$conum = 10">❿</xsl:when> 128 </xsl:choose> 129 </xsl:when> 130 <xsl:otherwise> 131 <xsl:message> 132 <xsl:text>Don't know how to generate Unicode callouts </xsl:text> 133 <xsl:text>when $callout.unicode.start.character is </xsl:text> 134 <xsl:value-of select="$callout.unicode.start.character"/> 135 </xsl:message> 136 <xsl:text>(</xsl:text> 137 <xsl:value-of select="$conum"/> 138 <xsl:text>)</xsl:text> 139 </xsl:otherwise> 140 </xsl:choose> 141 </xsl:when> 142 <xsl:otherwise> 143 <xsl:text>(</xsl:text> 144 <xsl:value-of select="$conum"/> 145 <xsl:text>)</xsl:text> 146 </xsl:otherwise> 147 </xsl:choose> 148</xsl:template> 149 150</xsl:stylesheet> 151