source: stylesheets/xhtml/lfs-xref.xsl@ 276015d2

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 276015d2 was 276015d2, checked in by Randy McMurchy <randy@…>, 17 years ago

Added the LastChangedBy and Date keywords then set the corresponding keyword property on each file in the repo

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@6430 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 11.5 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns="http://www.w3.org/1999/xhtml"
5 version="1.0">
6
7<!--
8$LastChangedBy$
9$Date$
10-->
11
12 <!-- Making a proper punctuation in xref (only for English language).-->
13 <xsl:template match="xref" name="xref">
14 <xsl:variable name="targets" select="key('id',@linkend)"/>
15 <xsl:variable name="target" select="$targets[1]"/>
16 <xsl:variable name="refelem" select="local-name($target)"/>
17 <xsl:variable name="role" select="@role"/>
18 <xsl:call-template name="check.id.unique">
19 <xsl:with-param name="linkend" select="@linkend"/>
20 </xsl:call-template>
21 <xsl:call-template name="anchor"/>
22 <xsl:choose>
23 <xsl:when test="count($target) = 0">
24 <xsl:message>
25 <xsl:text>XRef to nonexistent id: </xsl:text>
26 <xsl:value-of select="@linkend"/>
27 </xsl:message>
28 <xsl:text>???</xsl:text>
29 </xsl:when>
30 <xsl:when test="$target/@xreflabel">
31 <a>
32 <xsl:attribute name="href">
33 <xsl:call-template name="href.target">
34 <xsl:with-param name="object" select="$target"/>
35 </xsl:call-template>
36 </xsl:attribute>
37 <xsl:call-template name="xref.xreflabel">
38 <xsl:with-param name="target" select="$target"/>
39 </xsl:call-template>
40 </a>
41 </xsl:when>
42 <xsl:otherwise>
43 <xsl:variable name="href">
44 <xsl:call-template name="href.target">
45 <xsl:with-param name="object" select="$target"/>
46 </xsl:call-template>
47 </xsl:variable>
48 <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
49 <a href="{$href}">
50 <xsl:if test="$target/title or $target/*/title">
51 <xsl:attribute name="title">
52 <xsl:apply-templates select="$target" mode="xref-title"/>
53 </xsl:attribute>
54 </xsl:if>
55 <xsl:apply-templates select="$target" mode="xref-to">
56 <xsl:with-param name="referrer" select="."/>
57 <xsl:with-param name="role" select="$role"/>
58 <xsl:with-param name="xrefstyle">
59 <xsl:value-of select="@xrefstyle"/>
60 </xsl:with-param>
61 </xsl:apply-templates>
62 </a>
63 <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
64 </xsl:otherwise>
65 </xsl:choose>
66 </xsl:template>
67
68 <xsl:template match="section|simplesect|sect1|sect2|sect3|sect4|sect5|refsect1
69 |refsect2|refsect3|refsection" mode="xref-to">
70 <xsl:param name="referrer"/>
71 <xsl:param name="xrefstyle"/>
72 <xsl:param name="role"/>
73 <xsl:apply-templates select="." mode="object.xref.markup">
74 <xsl:with-param name="purpose" select="'xref'"/>
75 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
76 <xsl:with-param name="referrer" select="$referrer"/>
77 <xsl:with-param name="role" select="$role"/>
78 </xsl:apply-templates>
79 </xsl:template>
80
81
82 <xsl:template match="*" mode="object.xref.markup">
83 <xsl:param name="purpose"/>
84 <xsl:param name="xrefstyle"/>
85 <xsl:param name="referrer"/>
86 <xsl:param name="role"/>
87 <xsl:variable name="template">
88 <xsl:choose>
89 <xsl:when test="starts-with(normalize-space($xrefstyle), 'select:')">
90 <xsl:call-template name="make.gentext.template">
91 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
92 <xsl:with-param name="purpose" select="$purpose"/>
93 <xsl:with-param name="referrer" select="$referrer"/>
94 </xsl:call-template>
95 </xsl:when>
96 <xsl:when test="starts-with(normalize-space($xrefstyle), 'template:')">
97 <xsl:value-of select="substring-after(normalize-space($xrefstyle), 'template:')"/>
98 </xsl:when>
99 <xsl:otherwise>
100 <xsl:apply-templates select="." mode="object.xref.template">
101 <xsl:with-param name="purpose" select="$purpose"/>
102 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
103 <xsl:with-param name="referrer" select="$referrer"/>
104 </xsl:apply-templates>
105 </xsl:otherwise>
106 </xsl:choose>
107 </xsl:variable>
108 <xsl:if test="$template = ''">
109 <xsl:message>
110 <xsl:text>object.xref.markup: empty xref template</xsl:text>
111 <xsl:text> for linkend="</xsl:text>
112 <xsl:value-of select="@id"/>
113 <xsl:text>" and @xrefstyle="</xsl:text>
114 <xsl:value-of select="$xrefstyle"/>
115 <xsl:text>"</xsl:text>
116 </xsl:message>
117 </xsl:if>
118 <xsl:call-template name="substitute-markup">
119 <xsl:with-param name="purpose" select="$purpose"/>
120 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
121 <xsl:with-param name="referrer" select="$referrer"/>
122 <xsl:with-param name="template" select="$template"/>
123 <xsl:with-param name="role" select="$role"/>
124 </xsl:call-template>
125 </xsl:template>
126
127 <xsl:template name="substitute-markup">
128 <xsl:param name="template" select="''"/>
129 <xsl:param name="allow-anchors" select="'0'"/>
130 <xsl:param name="title" select="''"/>
131 <xsl:param name="subtitle" select="''"/>
132 <xsl:param name="label" select="''"/>
133 <xsl:param name="pagenumber" select="''"/>
134 <xsl:param name="purpose"/>
135 <xsl:param name="xrefstyle"/>
136 <xsl:param name="referrer"/>
137 <xsl:param name="role"/>
138 <xsl:choose>
139 <xsl:when test="contains($template, '%')">
140 <xsl:value-of select="substring-before($template, '%')"/>
141 <xsl:variable name="candidate"
142 select="substring(substring-after($template, '%'), 1, 1)"/>
143 <xsl:choose>
144 <xsl:when test="$candidate = 't'">
145 <xsl:apply-templates select="." mode="insert.title.markup">
146 <xsl:with-param name="purpose" select="$purpose"/>
147 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
148 <xsl:with-param name="role" select="$role"/>
149 <xsl:with-param name="title">
150 <xsl:choose>
151 <xsl:when test="$title != ''">
152 <xsl:copy-of select="$title"/>
153 </xsl:when>
154 <xsl:otherwise>
155 <xsl:apply-templates select="." mode="title.markup">
156 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
157 </xsl:apply-templates>
158 </xsl:otherwise>
159 </xsl:choose>
160 </xsl:with-param>
161 </xsl:apply-templates>
162 </xsl:when>
163 <xsl:when test="$candidate = 's'">
164 <xsl:apply-templates select="." mode="insert.subtitle.markup">
165 <xsl:with-param name="purpose" select="$purpose"/>
166 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
167 <xsl:with-param name="subtitle">
168 <xsl:choose>
169 <xsl:when test="$subtitle != ''">
170 <xsl:copy-of select="$subtitle"/>
171 </xsl:when>
172 <xsl:otherwise>
173 <xsl:apply-templates select="." mode="subtitle.markup">
174 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
175 </xsl:apply-templates>
176 </xsl:otherwise>
177 </xsl:choose>
178 </xsl:with-param>
179 </xsl:apply-templates>
180 </xsl:when>
181 <xsl:when test="$candidate = 'n'">
182 <xsl:apply-templates select="." mode="insert.label.markup">
183 <xsl:with-param name="purpose" select="$purpose"/>
184 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
185 <xsl:with-param name="label">
186 <xsl:choose>
187 <xsl:when test="$label != ''">
188 <xsl:copy-of select="$label"/>
189 </xsl:when>
190 <xsl:otherwise>
191 <xsl:apply-templates select="." mode="label.markup"/>
192 </xsl:otherwise>
193 </xsl:choose>
194 </xsl:with-param>
195 </xsl:apply-templates>
196 </xsl:when>
197 <xsl:when test="$candidate = 'p'">
198 <xsl:apply-templates select="." mode="insert.pagenumber.markup">
199 <xsl:with-param name="purpose" select="$purpose"/>
200 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
201 <xsl:with-param name="pagenumber">
202 <xsl:choose>
203 <xsl:when test="$pagenumber != ''">
204 <xsl:copy-of select="$pagenumber"/>
205 </xsl:when>
206 <xsl:otherwise>
207 <xsl:apply-templates select="." mode="pagenumber.markup"/>
208 </xsl:otherwise>
209 </xsl:choose>
210 </xsl:with-param>
211 </xsl:apply-templates>
212 </xsl:when>
213 <xsl:when test="$candidate = 'd'">
214 <xsl:apply-templates select="." mode="insert.direction.markup">
215 <xsl:with-param name="purpose" select="$purpose"/>
216 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
217 <xsl:with-param name="direction">
218 <xsl:choose>
219 <xsl:when test="$referrer">
220 <xsl:variable name="referent-is-below">
221 <xsl:for-each select="preceding::xref">
222 <xsl:if test="generate-id(.) = generate-id($referrer)">1</xsl:if>
223 </xsl:for-each>
224 </xsl:variable>
225 <xsl:choose>
226 <xsl:when test="$referent-is-below = ''">
227 <xsl:call-template name="gentext">
228 <xsl:with-param name="key" select="'above'"/>
229 </xsl:call-template>
230 </xsl:when>
231 <xsl:otherwise>
232 <xsl:call-template name="gentext">
233 <xsl:with-param name="key" select="'below'"/>
234 </xsl:call-template>
235 </xsl:otherwise>
236 </xsl:choose>
237 </xsl:when>
238 <xsl:otherwise>
239 <xsl:message>Attempt to use %d in gentext with no referrer!</xsl:message>
240 </xsl:otherwise>
241 </xsl:choose>
242 </xsl:with-param>
243 </xsl:apply-templates>
244 </xsl:when>
245 <xsl:when test="$candidate = '%' ">
246 <xsl:text>%</xsl:text>
247 </xsl:when>
248 <xsl:otherwise>
249 <xsl:text>%</xsl:text><xsl:value-of select="$candidate"/>
250 </xsl:otherwise>
251 </xsl:choose>
252 <!-- recurse with the rest of the template string -->
253 <xsl:variable name="rest"
254 select="substring($template,
255 string-length(substring-before($template, '%'))+3)"/>
256 <xsl:call-template name="substitute-markup">
257 <xsl:with-param name="template" select="$rest"/>
258 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
259 <xsl:with-param name="title" select="$title"/>
260 <xsl:with-param name="subtitle" select="$subtitle"/>
261 <xsl:with-param name="label" select="$label"/>
262 <xsl:with-param name="pagenumber" select="$pagenumber"/>
263 <xsl:with-param name="purpose" select="$purpose"/>
264 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
265 <xsl:with-param name="referrer" select="$referrer"/>
266 <xsl:with-param name="role" select="$role"/>
267 </xsl:call-template>
268 </xsl:when>
269 <xsl:otherwise>
270 <xsl:value-of select="$template"/>
271 </xsl:otherwise>
272 </xsl:choose>
273 </xsl:template>
274
275</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.