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