source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/callout.xsl@ eba32cf

clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since eba32cf was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 7.0 KB
Line 
1<?xml version="1.0" encoding="ASCII"?>
2<!--This file was created automatically by html2xhtml-->
3<!--from the HTML stylesheets.-->
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="xalan://com.nwalsh.xalan.Verbatim" xmlns:lxslt="http://xml.apache.org/xslt" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="sverb xverb lxslt" version="1.0">
5
6<!-- ********************************************************************
7 $Id$
8 ********************************************************************
9
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
13
14 ******************************************************************** -->
15
16<lxslt:component prefix="xverb" functions="insertCallouts"/>
17
18<xsl:template match="programlistingco|screenco">
19 <xsl:variable name="verbatim" select="programlisting|screen"/>
20
21 <xsl:choose>
22 <xsl:when test="$use.extensions != '0' and $callouts.extension != '0'">
23 <xsl:variable name="rtf">
24 <xsl:apply-templates select="$verbatim">
25 <xsl:with-param name="suppress-numbers" select="'1'"/>
26 </xsl:apply-templates>
27 </xsl:variable>
28
29 <xsl:variable name="rtf-with-callouts">
30 <xsl:choose>
31 <xsl:when test="function-available('sverb:insertCallouts')">
32 <xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/>
33 </xsl:when>
34 <xsl:when test="function-available('xverb:insertCallouts')">
35 <xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/>
36 </xsl:when>
37 <xsl:otherwise>
38 <xsl:message terminate="yes">
39 <xsl:text>No insertCallouts function is available.</xsl:text>
40 </xsl:message>
41 </xsl:otherwise>
42 </xsl:choose>
43 </xsl:variable>
44
45 <xsl:choose>
46 <xsl:when test="$verbatim/@linenumbering = 'numbered' and $linenumbering.extension != '0'">
47 <div>
48 <xsl:apply-templates select="." mode="class.attribute"/>
49 <xsl:call-template name="number.rtf.lines">
50 <xsl:with-param name="rtf" select="$rtf-with-callouts"/>
51 <xsl:with-param name="pi.context" select="programlisting|screen"/>
52 </xsl:call-template>
53 <xsl:apply-templates select="calloutlist"/>
54 </div>
55 </xsl:when>
56 <xsl:otherwise>
57 <div>
58 <xsl:apply-templates select="." mode="class.attribute"/>
59 <xsl:copy-of select="$rtf-with-callouts"/>
60 <xsl:apply-templates select="calloutlist"/>
61 </div>
62 </xsl:otherwise>
63 </xsl:choose>
64 </xsl:when>
65 <xsl:otherwise>
66 <div>
67 <xsl:apply-templates select="." mode="class.attribute"/>
68 <xsl:apply-templates/>
69 </div>
70 </xsl:otherwise>
71 </xsl:choose>
72</xsl:template>
73
74<xsl:template match="areaspec|areaset|area">
75</xsl:template>
76
77<xsl:template match="areaset" mode="conumber">
78 <xsl:number count="area|areaset" format="1"/>
79</xsl:template>
80
81<xsl:template match="area" mode="conumber">
82 <xsl:number count="area|areaset" format="1"/>
83</xsl:template>
84
85<xsl:template match="co" name="co">
86 <!-- Support a single linkend in HTML -->
87 <xsl:variable name="targets" select="key('id', @linkends)"/>
88 <xsl:variable name="target" select="$targets[1]"/>
89 <xsl:choose>
90 <xsl:when test="$target">
91 <a>
92 <xsl:apply-templates select="." mode="class.attribute"/>
93 <xsl:if test="@id or @xml:id">
94 <xsl:attribute name="id">
95 <xsl:value-of select="(@id|@xml:id)[1]"/>
96 </xsl:attribute>
97 </xsl:if>
98 <xsl:attribute name="href">
99 <xsl:call-template name="href.target">
100 <xsl:with-param name="object" select="$target"/>
101 </xsl:call-template>
102 </xsl:attribute>
103 <xsl:apply-templates select="." mode="callout-bug"/>
104 </a>
105 </xsl:when>
106 <xsl:otherwise>
107 <xsl:call-template name="anchor"/>
108 <xsl:apply-templates select="." mode="callout-bug"/>
109 </xsl:otherwise>
110 </xsl:choose>
111</xsl:template>
112
113<xsl:template match="coref">
114 <!-- tricky; this relies on the fact that we can process the "co" that's -->
115 <!-- "over there" as if it were "right here" -->
116
117 <xsl:variable name="co" select="key('id', @linkend)"/>
118 <xsl:choose>
119 <xsl:when test="not($co)">
120 <xsl:message>
121 <xsl:text>Error: coref link is broken: </xsl:text>
122 <xsl:value-of select="@linkend"/>
123 </xsl:message>
124 </xsl:when>
125 <xsl:when test="local-name($co) != 'co'">
126 <xsl:message>
127 <xsl:text>Error: coref doesn't point to a co: </xsl:text>
128 <xsl:value-of select="@linkend"/>
129 </xsl:message>
130 </xsl:when>
131 <xsl:otherwise>
132 <xsl:apply-templates select="$co"/>
133 </xsl:otherwise>
134 </xsl:choose>
135</xsl:template>
136
137<xsl:template match="co" mode="callout-bug">
138 <xsl:call-template name="callout-bug">
139 <xsl:with-param name="conum">
140 <xsl:number count="co" level="any" from="programlisting|screen|literallayout|synopsis" format="1"/>
141 </xsl:with-param>
142 </xsl:call-template>
143</xsl:template>
144
145<xsl:template name="callout-bug">
146 <xsl:param name="conum" select="1"/>
147
148 <xsl:choose>
149 <xsl:when test="$callout.graphics != 0 and $conum &lt;= $callout.graphics.number.limit">
150 <img src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}" alt="{$conum}" border="0"/>
151 </xsl:when>
152 <xsl:when test="$callout.unicode != 0 and $conum &lt;= $callout.unicode.number.limit">
153 <xsl:choose>
154 <xsl:when test="$callout.unicode.start.character = 10102">
155 <xsl:choose>
156 <xsl:when test="$conum = 1">&#10102;</xsl:when>
157 <xsl:when test="$conum = 2">&#10103;</xsl:when>
158 <xsl:when test="$conum = 3">&#10104;</xsl:when>
159 <xsl:when test="$conum = 4">&#10105;</xsl:when>
160 <xsl:when test="$conum = 5">&#10106;</xsl:when>
161 <xsl:when test="$conum = 6">&#10107;</xsl:when>
162 <xsl:when test="$conum = 7">&#10108;</xsl:when>
163 <xsl:when test="$conum = 8">&#10109;</xsl:when>
164 <xsl:when test="$conum = 9">&#10110;</xsl:when>
165 <xsl:when test="$conum = 10">&#10111;</xsl:when>
166 </xsl:choose>
167 </xsl:when>
168 <xsl:otherwise>
169 <xsl:message>
170 <xsl:text>Don't know how to generate Unicode callouts </xsl:text>
171 <xsl:text>when $callout.unicode.start.character is </xsl:text>
172 <xsl:value-of select="$callout.unicode.start.character"/>
173 </xsl:message>
174 <xsl:text>(</xsl:text>
175 <xsl:value-of select="$conum"/>
176 <xsl:text>)</xsl:text>
177 </xsl:otherwise>
178 </xsl:choose>
179 </xsl:when>
180 <xsl:otherwise>
181 <xsl:text>(</xsl:text>
182 <xsl:value-of select="$conum"/>
183 <xsl:text>)</xsl:text>
184 </xsl:otherwise>
185 </xsl:choose>
186</xsl:template>
187
188</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.