Debian Codegraph @

xslt/mallard/html/mal2html-links.xsl

raw
1 <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
2 <!--
3 This program is free software; you can redistribute it and/or modify it under
4 the terms of the GNU Lesser General Public License as published by the Free
5 Software Foundation; either version 2 of the License, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 details.
12
13 You should have received a copy of the GNU Lesser General Public License
14 along with this program; see the file COPYING.LGPL. If not, see <http://www.gnu.org/licenses/>.
15 -->
16
17 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18 xmlns:mal="http://projectmallard.org/1.0/"
19 xmlns:ui="http://projectmallard.org/ui/1.0/"
20 xmlns:uix="http://projectmallard.org/experimental/ui/"
21 xmlns:e="http://projectmallard.org/experimental/"
22 xmlns:api="http://projectmallard.org/experimental/api/"
23 xmlns:exsl="http://exslt.org/common"
24 xmlns:math="http://exslt.org/math"
25 xmlns:str="http://exslt.org/strings"
26 xmlns:html="http://www.w3.org/1999/xhtml"
27 xmlns="http://www.w3.org/1999/xhtml"
28 exclude-result-prefixes="mal ui uix e api exsl math str html"
29 version="1.0">
30
31
32 <!--!!==========================================================================
33 Mallard to HTML - Links
34
35 This stylesheet contains templates to handle automatic linking, both using the
36 Mallard links element and implicitly.
37 -->
38
39
40 <xsl:template match="mal:links"/>
41
42
43 <!--**==========================================================================
44 mal2html.links.links
45 Output links in one of a number of formats.
46 @revision[version=3.10 date=2013-07-30 status=final]
47
48 [xsl:params]
49 $node: A `links`, `page`, or `section` element to link from.
50 $depth: The depth level for the HTML header element.
51 $links: A list of links, as from a template in {mal-link}.
52 $role: A space-separated list of link roles, used to select the appropriate title.
53 $divs: Whether to default to divs instead of a list.
54 $title: A default title to use if no `title` element is found.
55
56 This is a common formatting template used by some `links` element handlers.
57 It selects an appropriate way to render the links based on style hints and
58 extension attributes on $node. This template (or the templates it calls)
59 will pass through `class` and `data-*` attributes found on the `link`
60 elements to the top-level container element of each output link.
61
62 This template handles link sorting.
63
64 If $node is a `links` element with a `title` element, that `title`
65 element will be processed as the title. Otherwise, the optional $title
66 parameter will be used if provided.
67 -->
68 <xsl:template name="mal2html.links.links">
69 <xsl:param name="node" select="."/>
70 <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
71 <xsl:param name="links" select="/false"/>
72 <xsl:param name="role" select="''"/>
73 <xsl:param name="divs" select="false()"/>
74 <xsl:param name="title" select="''"/>
75 <xsl:variable name="lastrole" select="str:split($role)[last()]"/>
76 <!-- We use the style attribute on page for links styles for backwards
77 compatibility, but only for topic links. -->
78 <xsl:variable name="style" select="concat(' ', $node[self::mal:links or $lastrole = 'topic']/@style, ' ')"/>
79 <xsl:variable name="nodesc" select="contains($style, ' nodesc ')"/>
80 <xsl:variable name="maltitle" select="$node/self::mal:links/mal:title"/>
81 <xsl:variable name="depth_">
82 <xsl:choose>
83 <xsl:when test="$depth &lt; 6">
84 <xsl:value-of select="$depth"/>
85 </xsl:when>
86 <xsl:otherwise>
87 <xsl:value-of select="6"/>
88 </xsl:otherwise>
89 </xsl:choose>
90 </xsl:variable>
91 <div>
92 <xsl:call-template name="html.class.attr">
93 <xsl:with-param name="node" select="$node[self::mal:links]"/>
94 <xsl:with-param name="class">
95 <xsl:text>links </xsl:text>
96 <xsl:if test="$lastrole != ''">
97 <xsl:value-of select="concat($lastrole, 'links')"/>
98 </xsl:if>
99 <xsl:call-template name="mal2html.ui.expander.class">
100 <xsl:with-param name="node" select="$node"/>
101 <xsl:with-param name="hastitle" select="$maltitle or ($title != '')"/>
102 </xsl:call-template>
103 <xsl:if test="contains($style, ' center ')">
104 <xsl:text> links-center</xsl:text>
105 </xsl:if>
106 </xsl:with-param>
107 </xsl:call-template>
108 <xsl:call-template name="mal2html.ui.expander.data">
109 <xsl:with-param name="node" select="$node"/>
110 <xsl:with-param name="hastitle" select="$maltitle or ($title != '')"/>
111 </xsl:call-template>
112 <div class="inner">
113 <xsl:choose>
114 <xsl:when test="$maltitle">
115 <xsl:apply-templates mode="mal2html.block.mode" select="$maltitle">
116 <xsl:with-param name="depth" select="$depth"/>
117 </xsl:apply-templates>
118 </xsl:when>
119 <xsl:when test="$title != ''">
120 <div class="title">
121 <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
122 <span class="title">
123 <xsl:value-of select="$title"/>
124 </span>
125 </xsl:element>
126 </div>
127 </xsl:when>
128 </xsl:choose>
129 <div class="region">
130 <xsl:variable name="uithumbs">
131 <xsl:variable name="uithumbs_">
132 <xsl:for-each select="str:split(@uix:thumbs)">
133 <xsl:if test="string(.)='tiles' or string(.)='hover'">
134 <xsl:value-of select="."/>
135 </xsl:if>
136 <xsl:text> </xsl:text>
137 </xsl:for-each>
138 </xsl:variable>
139 <xsl:value-of select="str:split($uithumbs_)[1]"/>
140 </xsl:variable>
141 <xsl:choose>
142 <xsl:when test="$node/self::mal:links/@api:type='function'">
143 <xsl:call-template name="mal2html.api.links.function">
144 <xsl:with-param name="node" select="$node"/>
145 <xsl:with-param name="links" select="$links"/>
146 </xsl:call-template>
147 </xsl:when>
148 <!-- FIXME delete this style -->
149 <xsl:when test="$uithumbs = 'tiles'">
150 <xsl:call-template name="mal2html.ui.links.tiles">
151 <xsl:with-param name="node" select="$node"/>
152 <xsl:with-param name="links" select="$links"/>
153 <xsl:with-param name="role" select="$role"/>
154 </xsl:call-template>
155 </xsl:when>
156 <!-- FIXME delete this style -->
157 <xsl:when test="$uithumbs = 'hover'">
158 <xsl:call-template name="_mal2html.ui.links.hover">
159 <xsl:with-param name="node" select="$node"/>
160 <xsl:with-param name="links" select="$links"/>
161 <xsl:with-param name="role" select="$role"/>
162 </xsl:call-template>
163 </xsl:when>
164 <!-- FIXME delete this style -->
165 <xsl:when test="contains($style, ' mouseovers ')">
166 <xsl:call-template name="_mal2html.links.mouseovers">
167 <xsl:with-param name="node" select="$node"/>
168 <xsl:with-param name="links" select="$links"/>
169 </xsl:call-template>
170 </xsl:when>
171 <xsl:when test="contains($style, ' experimental-gnome-top ')">
172 <xsl:call-template name="_mal2html.links.experimental_gnome_top">
173 <xsl:with-param name="node" select="$node"/>
174 <xsl:with-param name="links" select="$links"/>
175 <xsl:with-param name="role" select="$role"/>
176 </xsl:call-template>
177 </xsl:when>
178 <xsl:when test="contains($style, ' experimental-gnome-tiles ')">
179 <xsl:call-template name="_mal2html.links.experimental_gnome_tiles">
180 <xsl:with-param name="node" select="$node"/>
181 <xsl:with-param name="links" select="$links"/>
182 <xsl:with-param name="role" select="$role"/>
183 </xsl:call-template>
184 </xsl:when>
185 <xsl:when test="contains($style, ' toronto ') or contains($style, ' grid ')">
186 <xsl:call-template name="_mal2html.links.grid">
187 <xsl:with-param name="node" select="$node"/>
188 <xsl:with-param name="links" select="$links"/>
189 <xsl:with-param name="role" select="$role"/>
190 </xsl:call-template>
191 </xsl:when>
192 <!-- FIXME delete this style -->
193 <xsl:when test="contains($style, ' norwich ')">
194 <xsl:call-template name="_mal2html.links.norwich">
195 <xsl:with-param name="node" select="$node"/>
196 <xsl:with-param name="links" select="$links"/>
197 <xsl:with-param name="role" select="$role"/>
198 </xsl:call-template>
199 </xsl:when>
200 <xsl:when test="contains($style, ' linklist ')">
201 <xsl:variable name="bold" select="contains($style, ' bold ')"/>
202 <xsl:call-template name="mal2html.links.ul">
203 <xsl:with-param name="node" select="$node"/>
204 <xsl:with-param name="links" select="$links"/>
205 <xsl:with-param name="role" select="$role"/>
206 <xsl:with-param name="bold" select="$bold"/>
207 <xsl:with-param name="nodesc" select="$nodesc"/>
208 </xsl:call-template>
209 </xsl:when>
210 <xsl:when test="contains($style, ' button ')">
211 <xsl:call-template name="_mal2html.links.button">
212 <xsl:with-param name="node" select="$node"/>
213 <xsl:with-param name="links" select="$links"/>
214 <xsl:with-param name="role" select="$role"/>
215 <xsl:with-param name="nodesc" select="$nodesc"/>
216 </xsl:call-template>
217 </xsl:when>
218 <xsl:when test="contains($style, ' heading ')">
219 <xsl:call-template name="_mal2html.links.heading">
220 <xsl:with-param name="node" select="$node"/>
221 <xsl:with-param name="links" select="$links"/>
222 <xsl:with-param name="role" select="$role"/>
223 <xsl:with-param name="nodesc" select="$nodesc"/>
224 </xsl:call-template>
225 </xsl:when>
226 <xsl:when test="contains($style, ' 2column ')">
227 <xsl:variable name="coltot" select="ceiling(count($links) div 2)"/>
228 <div class="links-twocolumn">
229 <xsl:call-template name="_mal2html.links.divs">
230 <xsl:with-param name="node" select="$node"/>
231 <xsl:with-param name="links" select="$links"/>
232 <xsl:with-param name="role" select="$role"/>
233 <xsl:with-param name="nodesc" select="$nodesc"/>
234 <xsl:with-param name="max" select="$coltot"/>
235 </xsl:call-template>
236 <xsl:call-template name="_mal2html.links.divs">
237 <xsl:with-param name="node" select="$node"/>
238 <xsl:with-param name="links" select="$links"/>
239 <xsl:with-param name="role" select="$role"/>
240 <xsl:with-param name="nodesc" select="$nodesc"/>
241 <xsl:with-param name="min" select="$coltot"/>
242 </xsl:call-template>
243 </div>
244 </xsl:when>
245 <xsl:when test="$divs">
246 <xsl:call-template name="_mal2html.links.divs">
247 <xsl:with-param name="node" select="$node"/>
248 <xsl:with-param name="links" select="$links"/>
249 <xsl:with-param name="role" select="$role"/>
250 <xsl:with-param name="nodesc" select="$nodesc"/>
251 </xsl:call-template>
252 </xsl:when>
253 <xsl:otherwise>
254 <xsl:variable name="bold" select="contains($style, ' bold ')"/>
255 <xsl:call-template name="mal2html.links.ul">
256 <xsl:with-param name="node" select="$node"/>
257 <xsl:with-param name="links" select="$links"/>
258 <xsl:with-param name="role" select="$role"/>
259 <xsl:with-param name="bold" select="$bold"/>
260 <xsl:with-param name="nodesc" select="$nodesc"/>
261 </xsl:call-template>
262 </xsl:otherwise>
263 </xsl:choose>
264 </div>
265 </div>
266 </div>
267 </xsl:template>
268
269
270 <!--**==========================================================================
271 mal2html.links.ul
272 Output links in an HTML `ul` element.
273 @revision[version=3.28 date=2017-08-04 status=final]
274
275 [xsl:params]
276 $node: A `links` element to link from.
277 $links: A list of links, as from a template in {mal-link}.
278 $role: A space-separated list of link roles, used to select the appropriate title.
279 $bold: Whether to bold the link titles.
280 $nodesc: Whether to omit descriptions.
281
282 This is a common formatting template used by some `links` element handlers.
283 It outputs an HTML `ul` element and calls {mal2html.links.ul.li} on each
284 link to output a list item with a link.
285
286 This template handles link sorting.
287 -->
288 <xsl:template name="mal2html.links.ul">
289 <xsl:param name="node" select="."/>
290 <xsl:param name="links" select="/false"/>
291 <xsl:param name="role" select="''"/>
292 <xsl:param name="bold" select="false()"/>
293 <xsl:param name="nodesc" select="false()"/>
294 <ul>
295 <xsl:for-each select="$links">
296 <xsl:sort data-type="number" select="@groupsort"/>
297 <xsl:sort select="mal:title[@type = 'sort']"/>
298 <xsl:call-template name="mal2html.links.ul.li">
299 <xsl:with-param name="node" select="$node"/>
300 <xsl:with-param name="link" select="."/>
301 <xsl:with-param name="role" select="$role"/>
302 <xsl:with-param name="bold" select="$bold"/>
303 <xsl:with-param name="nodesc" select="$nodesc"/>
304 </xsl:call-template>
305 </xsl:for-each>
306 </ul>
307 </xsl:template>
308
309
310 <!--**==========================================================================
311 mal2html.links.ul.li
312 Output a list item with a link.
313 @revision[version=3.10 date=2013-07-30 status=final]
314
315 [xsl:params]
316 $node: A `links` element to link from.
317 $link: The `link` element from a list of links.
318 $xref: An `xref` string pointing to the target node.
319 $role: A space-separated list of link roles, used to select the appropriate title.
320 $bold: Whether to bold the link titles.
321 $nodesc: Whether to omit descriptions.
322
323 This template is called by {mal2html.links.ul} to output a list item with
324 a link for each target.
325 -->
326 <xsl:template name="mal2html.links.ul.li">
327 <xsl:param name="node" select="."/>
328 <xsl:param name="link" select="/false"/>
329 <xsl:param name="xref" select="@xref"/>
330 <xsl:param name="role" select="''"/>
331 <xsl:param name="bold" select="false()"/>
332 <xsl:param name="nodesc" select="false()"/>
333 <xsl:for-each select="$mal.cache">
334 <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
335 <li class="links {$link/@class}">
336 <xsl:for-each select="$link/@*">
337 <xsl:if test="starts-with(name(.), 'data-')">
338 <xsl:copy-of select="."/>
339 </xsl:if>
340 </xsl:for-each>
341 <a>
342 <xsl:if test="$bold">
343 <xsl:attribute name="class">
344 <xsl:text>bold</xsl:text>
345 </xsl:attribute>
346 </xsl:if>
347 <xsl:attribute name="href">
348 <xsl:call-template name="mal.link.target">
349 <xsl:with-param name="node" select="$node"/>
350 <xsl:with-param name="xref" select="$xref"/>
351 <xsl:with-param name="href" select="$link/@href"/>
352 </xsl:call-template>
353 </xsl:attribute>
354 <xsl:attribute name="title">
355 <xsl:call-template name="mal.link.tooltip">
356 <xsl:with-param name="node" select="$node"/>
357 <xsl:with-param name="xref" select="$xref"/>
358 <xsl:with-param name="href" select="$link/@href"/>
359 <xsl:with-param name="role" select="$role"/>
360 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
361 </xsl:call-template>
362 </xsl:attribute>
363 <xsl:call-template name="mal.link.content">
364 <xsl:with-param name="node" select="$node"/>
365 <xsl:with-param name="xref" select="$xref"/>
366 <xsl:with-param name="href" select="$link/@href"/>
367 <xsl:with-param name="role" select="$role"/>
368 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
369 </xsl:call-template>
370 </a>
371 <xsl:call-template name="mal2html.editor.badge">
372 <xsl:with-param name="target" select="$target"/>
373 </xsl:call-template>
374 <xsl:if test="not($nodesc)">
375 <xsl:variable name="desc">
376 <xsl:call-template name="mal.link.desc">
377 <xsl:with-param name="node" select="$node"/>
378 <xsl:with-param name="xref" select="$xref"/>
379 <xsl:with-param name="href" select="$link/@href"/>
380 <xsl:with-param name="role" select="$role"/>
381 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
382 </xsl:call-template>
383 </xsl:variable>
384 <xsl:if test="exsl:node-set($desc)/node()">
385 <span class="desc">
386 <xsl:text> &#x2014; </xsl:text>
387 <xsl:copy-of select="$desc"/>
388 </span>
389 </xsl:if>
390 </xsl:if>
391 </li>
392 </xsl:for-each>
393 </xsl:template>
394
395
396 <!--**==========================================================================
397 mal2html.links.guide
398 Output guide links from a page or section.
399 @revision[version=3.4 date=2012-02-23 status=final]
400
401 [xsl:params]
402 $node: A `links`, `page`, or `section` element to link from.
403 $depth: The depth level for the HTML header element.
404 $links: A list of links from {mal.link.guidelinks}.
405
406 This template outputs guide links for a page or section. It does not extract
407 the links itself. They must be passed in with the $links parameter.
408 -->
409 <xsl:template name="mal2html.links.guide" match="mal:links[@type = 'guide']">
410 <xsl:param name="node" select="."/>
411 <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
412 <xsl:param name="links" select="/false"/>
413 <xsl:variable name="depth_">
414 <xsl:choose>
415 <xsl:when test="$depth &lt; 6">
416 <xsl:value-of select="$depth"/>
417 </xsl:when>
418 <xsl:otherwise>
419 <xsl:value-of select="6"/>
420 </xsl:otherwise>
421 </xsl:choose>
422 </xsl:variable>
423 <xsl:variable name="role" select="$node/self::mal:links/@role"/>
424 <xsl:if test="$links">
425 <xsl:call-template name="mal2html.links.links">
426 <xsl:with-param name="node" select="$node"/>
427 <xsl:with-param name="depth" select="$depth"/>
428 <xsl:with-param name="links" select="$links"/>
429 <xsl:with-param name="role" select="concat($role, ' guide')"/>
430 <xsl:with-param name="title">
431 <xsl:call-template name="l10n.gettext">
432 <xsl:with-param name="msgid" select="'More Information'"/>
433 </xsl:call-template>
434 </xsl:with-param>
435 </xsl:call-template>
436 </xsl:if>
437 </xsl:template>
438
439
440 <!--**==========================================================================
441 mal2html.links.prevnext
442 Output links to the previous and next pages.
443 @revision[version=3.32 date=2018-10-20 status=final]
444
445 [xsl:params]
446 $node: A `links` or `page` element to link from.
447
448 This template outputs links to the previous and next page in a Mallard series,
449 if they exist. The block containing the links is end-floated by default. The
450 links use the text "Previous" and "Next", although the actual page titles are
451 used for tooltips.
452
453 If $node is part of a series-type stack, this template uses the previous and
454 next pages in the stack. Otherwise, the previous page is a page with a next-type
455 link to $node, and the next page is whatever is pointed to by the next-type link
456 in $node.
457
458 If the `links` element has the style hint `top`, it will be inserted before
459 the page title, instead of in its position on the page. This is handled by the
460 calling functions in {mal2html-page}.
461 -->
462 <xsl:template name="mal2html.links.prevnext" match="mal:links[@type = 'prevnext']">
463 <xsl:param name="node" select="."/>
464 <xsl:variable name="page" select="$node/ancestor-or-self::mal:page[last()]"/>
465 <xsl:variable name="linkid">
466 <xsl:call-template name="mal.link.linkid">
467 <xsl:with-param name="node" select="$page"/>
468 </xsl:call-template>
469 </xsl:variable>
470 <xsl:variable name="next" select="$page/mal:info/mal:link[@type='next']"/>
471 <xsl:variable name="stacknext"
472 select="$page[parent::mal:stack[@type='series']]/following-sibling::mal:page[1]"/>
473 <xsl:for-each select="$mal.cache">
474 <xsl:variable name="prev" select="key('mal.cache.link.key', concat('next:', $linkid))"/>
475 <xsl:if test="$prev or $next or $stacknext">
476 <nav class="prevnext pagewide"><div class="inner">
477 <xsl:if test="$prev">
478 <a>
479 <xsl:attribute name="href">
480 <xsl:call-template name="mal.link.target">
481 <xsl:with-param name="node" select="$prev"/>
482 <xsl:with-param name="xref" select="$prev/../../@id"/>
483 </xsl:call-template>
484 </xsl:attribute>
485 <xsl:attribute name="title">
486 <xsl:call-template name="mal.link.tooltip">
487 <xsl:with-param name="node" select="$prev"/>
488 <xsl:with-param name="xref" select="$prev/../../@id"/>
489 </xsl:call-template>
490 </xsl:attribute>
491 <xsl:for-each select="$page">
492 <xsl:call-template name="l10n.gettext">
493 <xsl:with-param name="msgid" select="'Previous'"/>
494 </xsl:call-template>
495 </xsl:for-each>
496 </a>
497 </xsl:if>
498 <xsl:choose>
499 <xsl:when test="$stacknext">
500 <a>
501 <xsl:attribute name="href">
502 <xsl:call-template name="mal.link.target">
503 <xsl:with-param name="node" select="$stacknext"/>
504 <xsl:with-param name="xref" select="$stacknext/@id"/>
505 </xsl:call-template>
506 </xsl:attribute>
507 <xsl:attribute name="title">
508 <xsl:call-template name="mal.link.tooltip">
509 <xsl:with-param name="node" select="$stacknext"/>
510 <xsl:with-param name="xref" select="$stacknext/@id"/>
511 </xsl:call-template>
512 </xsl:attribute>
513 <xsl:for-each select="$page">
514 <xsl:call-template name="l10n.gettext">
515 <xsl:with-param name="msgid" select="'Next'"/>
516 </xsl:call-template>
517 </xsl:for-each>
518 </a>
519 </xsl:when>
520 <xsl:when test="$next">
521 <a>
522 <xsl:attribute name="href">
523 <xsl:call-template name="mal.link.target">
524 <xsl:with-param name="node" select="$next"/>
525 <xsl:with-param name="xref" select="$next/@xref"/>
526 </xsl:call-template>
527 </xsl:attribute>
528 <xsl:attribute name="title">
529 <xsl:call-template name="mal.link.tooltip">
530 <xsl:with-param name="node" select="$next"/>
531 <xsl:with-param name="xref" select="$next/@xref"/>
532 </xsl:call-template>
533 </xsl:attribute>
534 <xsl:for-each select="$page">
535 <xsl:call-template name="l10n.gettext">
536 <xsl:with-param name="msgid" select="'Next'"/>
537 </xsl:call-template>
538 </xsl:for-each>
539 </a>
540 </xsl:when>
541 <xsl:otherwise>
542 <span>
543 <xsl:for-each select="$page">
544 <xsl:call-template name="l10n.gettext">
545 <xsl:with-param name="msgid" select="'Next'"/>
546 </xsl:call-template>
547 </xsl:for-each>
548 </span>
549 </xsl:otherwise>
550 </xsl:choose>
551 </div></nav>
552 </xsl:if>
553 </xsl:for-each>
554 </xsl:template>
555
556
557 <!--**==========================================================================
558 mal2html.links.section
559 Output links to subsections.
560 @revision[version=1.0 date=2011-06-15 status=final]
561
562 [xsl:params]
563 $node: The section `links` element.
564 $depth: The depth level for the HTML header element.
565
566 This template outputs links to the child sections of the `page` or `section`
567 element containing $node.
568 -->
569 <xsl:template name="mal2html.links.section" match="mal:links[@type = 'section']">
570 <xsl:param name="node" select="."/>
571 <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
572 <xsl:variable name="role" select="$node/self::mal:links/@role"/>
573 <xsl:variable name="style" select="concat(' ', $node/@style, ' ')"/>
574 <xsl:variable name="sectdepth">
575 <xsl:choose>
576 <xsl:when test="number(@depth) > 1">
577 <xsl:value-of select="round(number(@depth))"/>
578 </xsl:when>
579 <xsl:otherwise>
580 <xsl:value-of select="1"/>
581 </xsl:otherwise>
582 </xsl:choose>
583 </xsl:variable>
584 <xsl:if test="$node/../mal:section">
585 <div role="navigation">
586 <xsl:attribute name="class">
587 <xsl:text>links sectionlinks</xsl:text>
588 <xsl:choose>
589 <xsl:when test="contains($style, ' floatstart ')">
590 <xsl:text> floatstart</xsl:text>
591 </xsl:when>
592 <xsl:when test="contains($style, ' floatend ')">
593 <xsl:text> floatend</xsl:text>
594 </xsl:when>
595 <xsl:when test="contains($style, ' floatleft ')">
596 <xsl:text> floatleft</xsl:text>
597 </xsl:when>
598 <xsl:when test="contains($style, ' floatright ')">
599 <xsl:text> floatright</xsl:text>
600 </xsl:when>
601 </xsl:choose>
602 <xsl:call-template name="mal2html.ui.expander.class">
603 <xsl:with-param name="node" select="$node"/>
604 </xsl:call-template>
605 </xsl:attribute>
606 <xsl:call-template name="mal2html.ui.expander.data">
607 <xsl:with-param name="node" select="$node"/>
608 </xsl:call-template>
609 <div class="inner">
610 <xsl:apply-templates mode="mal2html.block.mode" select="$node/mal:title">
611 <xsl:with-param name="depth" select="$depth"/>
612 </xsl:apply-templates>
613 <div class="region">
614 <xsl:call-template name="_mal2html.links.section.ul">
615 <xsl:with-param name="node" select="$node/.."/>
616 <xsl:with-param name="depth" select="number($sectdepth)"/>
617 <xsl:with-param name="role" select="$role"/>
618 </xsl:call-template>
619 </div>
620 </div>
621 </div>
622 </xsl:if>
623 </xsl:template>
624
625 <!--#* _mal2html.links.section.ul -->
626 <xsl:template name="_mal2html.links.section.ul">
627 <xsl:param name="node" select="."/>
628 <xsl:param name="depth"/>
629 <xsl:param name="role"/>
630 <xsl:param name="nodesc" select="false()"/>
631 <ul>
632 <xsl:for-each select="$node/mal:section">
633 <xsl:call-template name="mal2html.links.ul.li">
634 <xsl:with-param name="node" select="$node"/>
635 <xsl:with-param name="xref" select="concat(ancestor::mal:page[1]/@id, '#', @id)"/>
636 <xsl:with-param name="role" select="concat($role, ' section')"/>
637 <xsl:with-param name="nodesc" select="$nodesc"/>
638 </xsl:call-template>
639 <xsl:if test="$depth > 1 and mal:section">
640 <li class="links">
641 <ul>
642 <xsl:call-template name="_mal2html.links.section.ul">
643 <xsl:with-param name="node" select="."/>
644 <xsl:with-param name="depth" select="$depth - 1"/>
645 <xsl:with-param name="role" select="$role"/>
646 <xsl:with-param name="nodesc" select="$nodesc"/>
647 </xsl:call-template>
648 </ul>
649 </li>
650 </xsl:if>
651 </xsl:for-each>
652 </ul>
653 </xsl:template>
654
655
656 <!--**==========================================================================
657 mal2html.links.seealso
658 Output seealso links from a page or section.
659 @revision[version=3.4 date=2012-02-23 status=final]
660
661 [xsl:params]
662 $node: A `links`, `page`, or `section` element to link from.
663 $depth: The depth level for the HTML header element.
664 $links: A list of links from {mal.link.seealsolinks}.
665
666 This template outputs seealso links for a page or section. It does not extract
667 the links itself. They must be passed in with the $links parameter.
668 -->
669 <xsl:template name="mal2html.links.seealso" match="mal:links[@type = 'seealso']">
670 <xsl:param name="node" select="."/>
671 <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
672 <xsl:param name="links" select="/false"/>
673 <xsl:variable name="role" select="$node/self::mal:links/@role"/>
674 <xsl:if test="$links">
675 <xsl:call-template name="mal2html.links.links">
676 <xsl:with-param name="node" select="$node"/>
677 <xsl:with-param name="depth" select="$depth"/>
678 <xsl:with-param name="links" select="$links"/>
679 <xsl:with-param name="role" select="concat($role, ' seealso')"/>
680 <xsl:with-param name="title">
681 <xsl:call-template name="l10n.gettext">
682 <xsl:with-param name="msgid" select="'See Also'"/>
683 </xsl:call-template>
684 </xsl:with-param>
685 </xsl:call-template>
686 </xsl:if>
687 </xsl:template>
688
689
690 <!--**==========================================================================
691 mal2html.links.series
692 Output links to pages in a series.
693 @revision[version=1.0 date=2011-06-15 status=final]
694
695 [xsl:params]
696 $node: A `links` or `page` element to start from.
697
698 A series in Mallard is a list of page such that each page in the list has a
699 next link to the following page. This template outputs links to each page in
700 a series. The current page is output in its place, althought it is not a link.
701
702 This template calls {mal2html.links.series.prev} and
703 {mal2html.links.series.next} to find and output the links.
704 -->
705 <xsl:template name="mal2html.links.series" match="mal:links[@type = 'series']">
706 <xsl:param name="node" select="."/>
707 <xsl:variable name="page" select="$node/ancestor-or-self::mal:page[last()]"/>
708 <xsl:variable name="title" select="$node/self::mal:links/mal:title"/>
709 <xsl:variable name="stitle"
710 select="$node/ancestor::mal:stack/mal:info/mal:title[@type='series']"/>
711 <xsl:variable name="style" select="concat(' ', $node/@style, ' ')"/>
712 <xsl:variable name="role" select="$node/self::mal:links/@role"/>
713 <div>
714 <xsl:attribute name="class">
715 <xsl:text>links serieslinks</xsl:text>
716 <xsl:choose>
717 <xsl:when test="contains($style, ' floatstart ')">
718 <xsl:text> floatstart</xsl:text>
719 </xsl:when>
720 <xsl:when test="contains($style, ' floatend ')">
721 <xsl:text> floatend</xsl:text>
722 </xsl:when>
723 <xsl:when test="contains($style, ' floatleft ')">
724 <xsl:text> floatleft</xsl:text>
725 </xsl:when>
726 <xsl:when test="contains($style, ' floatright ')">
727 <xsl:text> floatright</xsl:text>
728 </xsl:when>
729 </xsl:choose>
730 <xsl:call-template name="mal2html.ui.expander.class">
731 <xsl:with-param name="node" select="$node"/>
732 <xsl:with-param name="hastitle" select="count($title) + count($stitle) > 0"/>
733 </xsl:call-template>
734 </xsl:attribute>
735 <xsl:call-template name="mal2html.ui.expander.data">
736 <xsl:with-param name="node" select="$node"/>
737 <xsl:with-param name="hastitle" select="count($title) + count($stitle) > 0"/>
738 </xsl:call-template>
739 <div class="inner">
740 <xsl:choose>
741 <xsl:when test="count($title) > 0">
742 <xsl:apply-templates mode="mal2html.block.mode" select="$title[1]"/>
743 </xsl:when>
744 <xsl:when test="count($stitle) > 0">
745 <xsl:apply-templates mode="mal2html.block.mode" select="$stitle[1]"/>
746 </xsl:when>
747 </xsl:choose>
748 <div class="region">
749 <ul>
750 <xsl:call-template name="mal2html.links.series.prev">
751 <xsl:with-param name="node" select="$page"/>
752 <xsl:with-param name="links" select="$node/self::mal:links"/>
753 </xsl:call-template>
754 <li class="links">
755 <xsl:call-template name="mal.link.content">
756 <xsl:with-param name="node" select="$page"/>
757 <xsl:with-param name="xref" select="$page/@id"/>
758 <xsl:with-param name="role" select="concat($role, ' series')"/>
759 </xsl:call-template>
760 </li>
761 <xsl:call-template name="mal2html.links.series.next">
762 <xsl:with-param name="node" select="$page"/>
763 <xsl:with-param name="links" select="$node/self::mal:links"/>
764 </xsl:call-template>
765 </ul>
766 </div>
767 </div>
768 </div>
769 </xsl:template>
770
771
772 <!--**==========================================================================
773 mal2html.links.series.prev
774 Output preceding links to pages in a series.
775 @revision[version=1.0 date=2011-06-15 status=final]
776
777 [xsl:params]
778 $node: The current `page` element.
779 $links: The series `links` element.
780
781 This template is called by {mal2html.links.series} to output the pages before
782 the starting page in the series. This template finds the previous page for the
783 page $node. It then calls itself recursively on that page, and outputs a link
784 to it.
785 -->
786 <xsl:template name="mal2html.links.series.prev">
787 <xsl:param name="node" select="."/>
788 <xsl:param name="links" select="/false"/>
789 <xsl:variable name="role" select="$links/self::mal:links/@role"/>
790 <xsl:variable name="linkid">
791 <xsl:call-template name="mal.link.linkid">
792 <xsl:with-param name="node" select="$node"/>
793 </xsl:call-template>
794 </xsl:variable>
795 <xsl:for-each select="$mal.cache">
796 <xsl:variable name="prev" select="key('mal.cache.link.key', concat('next:', $linkid))"/>
797 <xsl:if test="$prev">
798 <xsl:call-template name="mal2html.links.series.prev">
799 <xsl:with-param name="node" select="key('mal.cache.key', $prev/../../@id)"/>
800 <xsl:with-param name="links" select="$links"/>
801 </xsl:call-template>
802 <li class="links">
803 <a>
804 <xsl:attribute name="href">
805 <xsl:call-template name="mal.link.target">
806 <xsl:with-param name="node" select="$prev"/>
807 <xsl:with-param name="xref" select="$prev/../../@id"/>
808 </xsl:call-template>
809 </xsl:attribute>
810 <xsl:attribute name="title">
811 <xsl:call-template name="mal.link.tooltip">
812 <xsl:with-param name="node" select="$prev"/>
813 <xsl:with-param name="xref" select="$prev/../../@id"/>
814 <xsl:with-param name="role" select="concat($role, ' series')"/>
815 </xsl:call-template>
816 </xsl:attribute>
817 <xsl:call-template name="mal.link.content">
818 <xsl:with-param name="node" select="$prev"/>
819 <xsl:with-param name="xref" select="$prev/../../@id"/>
820 <xsl:with-param name="role" select="concat($role, ' series')"/>
821 </xsl:call-template>
822 </a>
823 </li>
824 </xsl:if>
825 </xsl:for-each>
826 </xsl:template>
827
828
829 <!--**==========================================================================
830 mal2html.links.series.next
831 Output following links to pages in a series.
832 @revision[version=3.32 date=2018-10-20 status=final]
833
834 [xsl:params]
835 $node: The current `page` element.
836 $links: The series `links` element.
837
838 This template is called by {mal2html.links.series} to output the pages after
839 the starting page in the series. This template finds the next page for the page
840 $node. It outputs a link to that page, then calls itself recursively on that
841 page.
842
843 If $node is part of a series-type stack, this template uses the next page in
844 the stack. Otherwise, it looks for a next-type link in $node.
845 -->
846 <xsl:template name="mal2html.links.series.next">
847 <xsl:param name="node" select="."/>
848 <xsl:param name="links" select="/false"/>
849 <xsl:variable name="role" select="$links/self::mal:links/@role"/>
850 <xsl:variable name="linkid">
851 <xsl:call-template name="mal.link.linkid">
852 <xsl:with-param name="node" select="$node"/>
853 </xsl:call-template>
854 </xsl:variable>
855 <xsl:variable name="next" select="$node/mal:info/mal:link[@type='next']"/>
856 <xsl:variable name="stacknext"
857 select="$node[parent::mal:stack[@type='series']]/following-sibling::mal:page[1]"/>
858 <xsl:choose>
859 <xsl:when test="$stacknext">
860 <xsl:for-each select="$mal.cache">
861 <li class="links">
862 <a>
863 <xsl:attribute name="href">
864 <xsl:call-template name="mal.link.target">
865 <xsl:with-param name="node" select="$stacknext"/>
866 <xsl:with-param name="xref" select="$stacknext/@id"/>
867 </xsl:call-template>
868 </xsl:attribute>
869 <xsl:attribute name="title">
870 <xsl:call-template name="mal.link.tooltip">
871 <xsl:with-param name="node" select="$stacknext"/>
872 <xsl:with-param name="xref" select="$stacknext/@id"/>
873 <xsl:with-param name="role" select="concat($role, ' series')"/>
874 </xsl:call-template>
875 </xsl:attribute>
876 <xsl:call-template name="mal.link.content">
877 <xsl:with-param name="node" select="$stacknext"/>
878 <xsl:with-param name="xref" select="$stacknext/@id"/>
879 <xsl:with-param name="role" select="concat($role, ' series')"/>
880 </xsl:call-template>
881 </a>
882 </li>
883 <xsl:call-template name="mal2html.links.series.next">
884 <xsl:with-param name="node" select="key('mal.cache.key', $stacknext/@id)"/>
885 <xsl:with-param name="links" select="$links"/>
886 </xsl:call-template>
887 </xsl:for-each>
888 </xsl:when>
889 <xsl:when test="$next">
890 <xsl:for-each select="$mal.cache">
891 <li class="links">
892 <a>
893 <xsl:attribute name="href">
894 <xsl:call-template name="mal.link.target">
895 <xsl:with-param name="node" select="$next"/>
896 <xsl:with-param name="xref" select="$next/@xref"/>
897 </xsl:call-template>
898 </xsl:attribute>
899 <xsl:attribute name="title">
900 <xsl:call-template name="mal.link.tooltip">
901 <xsl:with-param name="node" select="$next"/>
902 <xsl:with-param name="xref" select="$next/@xref"/>
903 <xsl:with-param name="role" select="concat($role, ' series')"/>
904 </xsl:call-template>
905 </xsl:attribute>
906 <xsl:call-template name="mal.link.content">
907 <xsl:with-param name="node" select="$next"/>
908 <xsl:with-param name="xref" select="$next/@xref"/>
909 <xsl:with-param name="role" select="concat($role, ' series')"/>
910 </xsl:call-template>
911 </a>
912 </li>
913 <xsl:call-template name="mal2html.links.series.next">
914 <xsl:with-param name="node" select="key('mal.cache.key', $next/@xref)"/>
915 <xsl:with-param name="links" select="$links"/>
916 </xsl:call-template>
917 </xsl:for-each>
918 </xsl:when>
919 </xsl:choose>
920 </xsl:template>
921
922
923 <!--**==========================================================================
924 mal2html.links.topic
925 Output topic links from a page or section.
926 @revision[version=3.4 date=2012-02-23 status=final]
927
928 [xsl:params]
929 $node: A `links`, `page`, or `section` element to link from.
930 $depth: The depth level for the HTML header element.
931 $links: A list of links from {mal.link.topiclinks}.
932 $groups: The list of link groups for this `links` element.
933 $allgroups: The list of all valid groups for the page or section.
934
935 This template outputs topic links for a page or section. It does not extract
936 the links itself. They must be passed in with the $links parameter. This
937 template only outputs links which have a group that matches $groups. The
938 $groups parameter is not expected to have the implicit groups `first`,
939 `default`, and `last`. These are added automatically by this template
940 when determining which links to output.
941 -->
942 <xsl:template name="mal2html.links.topic" match="mal:links[@type = 'topic']">
943 <xsl:param name="node" select="."/>
944 <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
945 <xsl:param name="links" select="/false"/>
946 <xsl:param name="groups">
947 <xsl:text> </xsl:text>
948 <xsl:choose>
949 <xsl:when test="$node/@groups">
950 <xsl:value-of select="$node/@groups"/>
951 </xsl:when>
952 <xsl:otherwise>
953 <xsl:text>#default</xsl:text>
954 </xsl:otherwise>
955 </xsl:choose>
956 <xsl:text> </xsl:text>
957 </xsl:param>
958 <xsl:param name="allgroups" select="''"/>
959 <xsl:variable name="role" select="$node/self::mal:links/@role"/>
960 <xsl:if test="$node/ancestor-or-self::mal:page[last()]/@type = 'guide'">
961 <xsl:variable name="_groups">
962 <xsl:if test="not(contains($allgroups, ' #first '))">
963 <xsl:if test="not($node/self::mal:links) or not($node/preceding-sibling::mal:links[@type = 'topic'])">
964 <xsl:text> #first </xsl:text>
965 </xsl:if>
966 </xsl:if>
967 <xsl:value-of select="$groups"/>
968 <xsl:if test="not(contains($allgroups, ' #default '))">
969 <xsl:if test="not($node/self::mal:links) or not($node/following-sibling::mal:links[@type = 'topic'])">
970 <xsl:text> #default </xsl:text>
971 </xsl:if>
972 </xsl:if>
973 <xsl:if test="not(contains($allgroups, ' #last '))">
974 <xsl:if test="not($node/self::mal:links) or not($node/following-sibling::mal:links[@type = 'topic'])">
975 <xsl:text> #last </xsl:text>
976 </xsl:if>
977 </xsl:if>
978 </xsl:variable>
979 <xsl:variable name="_links" select="$links[contains($_groups, concat(' ', @group, ' '))]"/>
980 <xsl:if test="count($_links) != 0">
981 <xsl:call-template name="mal2html.links.links">
982 <xsl:with-param name="node" select="$node"/>
983 <xsl:with-param name="depth" select="$depth"/>
984 <xsl:with-param name="links" select="$_links"/>
985 <xsl:with-param name="role" select="concat($role, ' topic')"/>
986 <xsl:with-param name="divs" select="true()"/>
987 </xsl:call-template>
988 </xsl:if>
989 </xsl:if>
990 </xsl:template>
991
992
993 <!--#* _mal2html.links.mouseovers -->
994 <xsl:template name="_mal2html.links.mouseovers">
995 <xsl:param name="node" select="."/>
996 <xsl:param name="links"/>
997 <xsl:variable name="role" select="$node/self::mal:links/@role"/>
998 <xsl:message>
999 <xsl:text>DEPRECATION WARNING: The mouseovers style on the links element is deprecated.</xsl:text>
1000 </xsl:message>
1001 <div class="links-uix-hover">
1002 <div class="links-uix-hover-img">
1003 <xsl:for-each select="$node/e:mouseover[not(@match)]">
1004 <img>
1005 <xsl:copy-of select="@src | @width | @height"/>
1006 </img>
1007 </xsl:for-each>
1008 </div>
1009 <ul class="links-uix-hover">
1010 <xsl:for-each select="$links">
1011 <xsl:sort data-type="number" select="@groupsort"/>
1012 <xsl:sort select="mal:title[@type = 'sort']"/>
1013 <xsl:variable name="link" select="."/>
1014 <xsl:variable name="xref" select="@xref"/>
1015 <xsl:for-each select="$mal.cache">
1016 <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
1017 <li class="links">
1018 <a class="bold">
1019 <xsl:attribute name="href">
1020 <xsl:call-template name="mal.link.target">
1021 <xsl:with-param name="node" select="$node"/>
1022 <xsl:with-param name="xref" select="$xref"/>
1023 <xsl:with-param name="href" select="$link/@href"/>
1024 </xsl:call-template>
1025 </xsl:attribute>
1026 <xsl:attribute name="title">
1027 <xsl:call-template name="mal.link.tooltip">
1028 <xsl:with-param name="node" select="$node"/>
1029 <xsl:with-param name="xref" select="$xref"/>
1030 <xsl:with-param name="href" select="$link/@href"/>
1031 <xsl:with-param name="role" select="concat($role, ' topic')"/>
1032 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1033 </xsl:call-template>
1034 </xsl:attribute>
1035 <xsl:for-each select="$node/e:mouseover[@match = $xref]">
1036 <span class="links-uix-hover-img">
1037 <img>
1038 <xsl:copy-of select="@src | @width | @height"/>
1039 </img>
1040 </span>
1041 </xsl:for-each>
1042 <xsl:call-template name="mal.link.content">
1043 <xsl:with-param name="node" select="$node"/>
1044 <xsl:with-param name="xref" select="$xref"/>
1045 <xsl:with-param name="href" select="$link/@href"/>
1046 <xsl:with-param name="role" select="concat($role, ' topic')"/>
1047 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1048 </xsl:call-template>
1049 </a>
1050 </li>
1051 </xsl:for-each>
1052 </xsl:for-each>
1053 </ul>
1054 </div>
1055 </xsl:template>
1056
1057
1058 <!--#* _mal2html.links.grid -->
1059 <xsl:template name="_mal2html.links.grid">
1060 <xsl:param name="node" select="."/>
1061 <xsl:param name="links"/>
1062 <xsl:param name="role"/>
1063 <div class="links-grid-container">
1064 <xsl:for-each select="$links">
1065 <xsl:sort data-type="number" select="@groupsort"/>
1066 <xsl:sort select="mal:title[@type = 'sort']"/>
1067 <xsl:variable name="link" select="."/>
1068 <xsl:variable name="xref" select="@xref"/>
1069 <div class="links-grid {@class}">
1070 <xsl:for-each select="@*">
1071 <xsl:if test="starts-with(name(.), 'data-')">
1072 <xsl:copy-of select="."/>
1073 </xsl:if>
1074 </xsl:for-each>
1075 <xsl:for-each select="$mal.cache">
1076 <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
1077 <div class="links-grid-link"><a>
1078 <xsl:attribute name="href">
1079 <xsl:call-template name="mal.link.target">
1080 <xsl:with-param name="node" select="$node"/>
1081 <xsl:with-param name="xref" select="$xref"/>
1082 <xsl:with-param name="href" select="$link/@href"/>
1083 </xsl:call-template>
1084 </xsl:attribute>
1085 <xsl:attribute name="title">
1086 <xsl:call-template name="mal.link.tooltip">
1087 <xsl:with-param name="node" select="$node"/>
1088 <xsl:with-param name="xref" select="$xref"/>
1089 <xsl:with-param name="href" select="$link/@href"/>
1090 <xsl:with-param name="role" select="$role"/>
1091 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1092 </xsl:call-template>
1093 </xsl:attribute>
1094 <xsl:call-template name="mal.link.content">
1095 <xsl:with-param name="node" select="$node"/>
1096 <xsl:with-param name="xref" select="$xref"/>
1097 <xsl:with-param name="href" select="$link/@href"/>
1098 <xsl:with-param name="role" select="$role"/>
1099 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1100 </xsl:call-template>
1101 </a></div>
1102 <xsl:variable name="desc">
1103 <xsl:call-template name="mal.link.desc">
1104 <xsl:with-param name="node" select="$node"/>
1105 <xsl:with-param name="xref" select="$xref"/>
1106 <xsl:with-param name="href" select="$link/@href"/>
1107 <xsl:with-param name="role" select="$role"/>
1108 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1109 </xsl:call-template>
1110 </xsl:variable>
1111 <xsl:if test="exsl:node-set($desc)/node()">
1112 <div class="desc">
1113 <span class="desc">
1114 <xsl:copy-of select="$desc"/>
1115 </span>
1116 </div>
1117 </xsl:if>
1118 </xsl:for-each>
1119 </div>
1120 </xsl:for-each>
1121 <!-- blank divs for homogeneous sizing -->
1122 <div class="links-grid"></div>
1123 <div class="links-grid"></div>
1124 </div>
1125 </xsl:template>
1126
1127 <!--#* _mal2html.links.norwich -->
1128 <xsl:template name="_mal2html.links.norwich">
1129 <xsl:param name="node" select="."/>
1130 <xsl:param name="links"/>
1131 <xsl:param name="role"/>
1132 <div class="links-norwich">
1133 <div class="links-norwich-primary">
1134 <xsl:for-each select="$links">
1135 <xsl:sort data-type="number" select="@groupsort"/>
1136 <xsl:sort select="mal:title[@type = 'sort']"/>
1137 <xsl:if test="position() &lt; 3">
1138 <xsl:variable name="link" select="."/>
1139 <xsl:variable name="xref" select="@xref"/>
1140 <xsl:for-each select="$mal.cache">
1141 <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
1142 <div class="links-norwich-big">
1143 <a>
1144 <xsl:attribute name="href">
1145 <xsl:call-template name="mal.link.target">
1146 <xsl:with-param name="node" select="$node"/>
1147 <xsl:with-param name="xref" select="$xref"/>
1148 <xsl:with-param name="href" select="$link/@href"/>
1149 </xsl:call-template>
1150 </xsl:attribute>
1151 <xsl:attribute name="title">
1152 <xsl:call-template name="mal.link.tooltip">
1153 <xsl:with-param name="node" select="$node"/>
1154 <xsl:with-param name="xref" select="$xref"/>
1155 <xsl:with-param name="href" select="$link/@href"/>
1156 <xsl:with-param name="role" select="$role"/>
1157 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1158 </xsl:call-template>
1159 </xsl:attribute>
1160 <!-- FIXME: role and dimensions -->
1161 <xsl:if test="$target/mal:info/uix:thumb">
1162 <xsl:attribute name="style">
1163 <xsl:text>background-image: url(</xsl:text>
1164 <xsl:value-of select="$target/mal:info/uix:thumb/@src"/>
1165 <xsl:text>);</xsl:text>
1166 </xsl:attribute>
1167 </xsl:if>
1168 <span class="title">
1169 <xsl:call-template name="mal.link.content">
1170 <xsl:with-param name="node" select="$node"/>
1171 <xsl:with-param name="xref" select="$xref"/>
1172 <xsl:with-param name="href" select="$link/@href"/>
1173 <xsl:with-param name="role" select="$role"/>
1174 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1175 </xsl:call-template>
1176 </span>
1177 <xsl:variable name="desc">
1178 <xsl:call-template name="mal.link.desc">
1179 <xsl:with-param name="node" select="$node"/>
1180 <xsl:with-param name="xref" select="$xref"/>
1181 <xsl:with-param name="href" select="$link/@href"/>
1182 <xsl:with-param name="role" select="$role"/>
1183 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1184 </xsl:call-template>
1185 </xsl:variable>
1186 <xsl:variable name="desc_" select="exsl:node-set($desc)"/>
1187 <xsl:if test="$desc_/node()">
1188 <div class="desc">
1189 <span class="desc">
1190 <xsl:apply-templates mode="_mal2html.links.divs.nolink.mode"
1191 select="$desc_"/>
1192 </span>
1193 </div>
1194 </xsl:if>
1195 </a>
1196 </div>
1197 </xsl:for-each>
1198 </xsl:if>
1199 </xsl:for-each>
1200 </div>
1201 <div class="links-norwich-secondary">
1202 <xsl:for-each select="$links">
1203 <xsl:sort data-type="number" select="@groupsort"/>
1204 <xsl:sort select="mal:title[@type = 'sort']"/>
1205 <xsl:if test="position() &gt;= 3">
1206 <xsl:variable name="link" select="."/>
1207 <xsl:variable name="xref" select="@xref"/>
1208 <xsl:for-each select="$mal.cache">
1209 <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
1210 <xsl:variable name="thumbs" select="$target/mal:info/uix:thumb"/>
1211 <div class="links-norwich-small">
1212 <a>
1213 <xsl:attribute name="href">
1214 <xsl:call-template name="mal.link.target">
1215 <xsl:with-param name="node" select="$node"/>
1216 <xsl:with-param name="xref" select="$xref"/>
1217 <xsl:with-param name="href" select="$link/@href"/>
1218 </xsl:call-template>
1219 </xsl:attribute>
1220 <xsl:attribute name="title">
1221 <xsl:call-template name="mal.link.tooltip">
1222 <xsl:with-param name="node" select="$node"/>
1223 <xsl:with-param name="xref" select="$xref"/>
1224 <xsl:with-param name="href" select="$link/@href"/>
1225 <xsl:with-param name="role" select="$role"/>
1226 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1227 </xsl:call-template>
1228 </xsl:attribute>
1229 <!-- FIXME: role and dimensions -->
1230 <xsl:if test="$target/mal:info/uix:thumb">
1231 <xsl:attribute name="style">
1232 <xsl:text>background-image: url(</xsl:text>
1233 <xsl:value-of select="$target/mal:info/uix:thumb/@src"/>
1234 <xsl:text>);</xsl:text>
1235 </xsl:attribute>
1236 </xsl:if>
1237 <span class="title">
1238 <xsl:call-template name="mal.link.content">
1239 <xsl:with-param name="node" select="$node"/>
1240 <xsl:with-param name="xref" select="$xref"/>
1241 <xsl:with-param name="href" select="$link/@href"/>
1242 <xsl:with-param name="role" select="$role"/>
1243 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1244 </xsl:call-template>
1245 </span>
1246 </a>
1247 </div>
1248 </xsl:for-each>
1249 </xsl:if>
1250 </xsl:for-each>
1251 </div>
1252 </div>
1253 <div class="clear"/>
1254 </xsl:template>
1255
1256
1257 <!--#* _mal2html.links.experimental_gnome_tiles -->
1258 <xsl:template name="_mal2html.links.experimental_gnome_tiles">
1259 <xsl:param name="node" select="."/>
1260 <xsl:param name="links"/>
1261 <xsl:param name="role"/>
1262 <div class="tiles">
1263 <xsl:for-each select="$links">
1264 <xsl:sort data-type="number" select="@groupsort"/>
1265 <xsl:sort select="mal:title[@type = 'sort']"/>
1266 <xsl:variable name="link" select="."/>
1267 <xsl:for-each select="$mal.cache">
1268 <xsl:variable name="target" select="key('mal.cache.key', $link/@xref)"/>
1269 <div class="tile2 {$link/@class}">
1270 <xsl:for-each select="$link/@*">
1271 <xsl:if test="starts-with(name(.), 'data-')">
1272 <xsl:copy-of select="."/>
1273 </xsl:if>
1274 </xsl:for-each>
1275 <xsl:variable name="infos" select="$target/mal:info | $link[@href]/mal:info"/>
1276 <xsl:variable name="thumbs" select="$infos/uix:thumb[@role='experimental-gnome-tiles']"/>
1277 <a class="ex-gnome-tile">
1278 <xsl:attribute name="href">
1279 <xsl:call-template name="mal.link.target">
1280 <xsl:with-param name="node" select="$node"/>
1281 <xsl:with-param name="xref" select="$link/@xref"/>
1282 <xsl:with-param name="href" select="$link/@href"/>
1283 </xsl:call-template>
1284 </xsl:attribute>
1285 <xsl:attribute name="title">
1286 <xsl:call-template name="mal.link.tooltip">
1287 <xsl:with-param name="node" select="$node"/>
1288 <xsl:with-param name="xref" select="$link/@xref"/>
1289 <xsl:with-param name="href" select="$link/@href"/>
1290 <xsl:with-param name="role" select="$role"/>
1291 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1292 </xsl:call-template>
1293 </xsl:attribute>
1294 <span class="ex-gnome-tiles-banner">
1295 <xsl:call-template name="mal2html.ui.links.img">
1296 <xsl:with-param name="node" select="$node"/>
1297 <xsl:with-param name="thumbs" select="$thumbs"/>
1298 <xsl:with-param name="role" select="$role"/>
1299 <xsl:with-param name="height" select="128"/>
1300 </xsl:call-template>
1301 </span>
1302 <span class="ex-gnome-tiles-text">
1303 <span class="ex-gnome-tiles-title">
1304 <xsl:call-template name="mal.link.content">
1305 <xsl:with-param name="node" select="$node"/>
1306 <xsl:with-param name="xref" select="$link/@xref"/>
1307 <xsl:with-param name="href" select="$link/@href"/>
1308 <xsl:with-param name="role" select="$role"/>
1309 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1310 </xsl:call-template>
1311 </span>
1312 <xsl:if test="not(contains(concat(' ', $node/@style, ' '), ' nodesc '))">
1313 <xsl:variable name="desc">
1314 <xsl:call-template name="mal.link.desc">
1315 <xsl:with-param name="node" select="$node"/>
1316 <xsl:with-param name="xref" select="$link/@xref"/>
1317 <xsl:with-param name="href" select="$link/@href"/>
1318 <xsl:with-param name="role" select="$role"/>
1319 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1320 </xsl:call-template>
1321 </xsl:variable>
1322 <xsl:variable name="desc_" select="exsl:node-set($desc)/node()"/>
1323 <xsl:if test="$desc_">
1324 <span class="linkdiv-dash">
1325 <xsl:text> &#x2014; </xsl:text>
1326 </span>
1327 <span class="ex-gnome-tiles-desc">
1328 <xsl:apply-templates mode="_mal2html.links.divs.nolink.mode"
1329 select="$desc_"/>
1330 </span>
1331 </xsl:if>
1332 </xsl:if>
1333 </span>
1334 </a>
1335 </div>
1336 </xsl:for-each>
1337 </xsl:for-each>
1338 <!-- blank tiles for homogeneous sizing -->
1339 <div class="tile2"></div>
1340 </div>
1341 </xsl:template>
1342
1343
1344 <!--#* _mal2html.links.experimental_gnome_top -->
1345 <xsl:template name="_mal2html.links.experimental_gnome_top">
1346 <xsl:param name="node" select="."/>
1347 <xsl:param name="links"/>
1348 <xsl:param name="role"/>
1349 <div class="tiles">
1350 <xsl:for-each select="$links">
1351 <xsl:sort data-type="number" select="@groupsort"/>
1352 <xsl:sort select="mal:title[@type = 'sort']"/>
1353 <xsl:variable name="link" select="."/>
1354 <xsl:for-each select="$mal.cache">
1355 <xsl:variable name="target" select="key('mal.cache.key', $link/@xref)"/>
1356 <div class="tile2 {$link/@class}">
1357 <xsl:for-each select="$link/@*">
1358 <xsl:if test="starts-with(name(.), 'data-')">
1359 <xsl:copy-of select="."/>
1360 </xsl:if>
1361 </xsl:for-each>
1362 <xsl:variable name="infos" select="$target/mal:info | $link[@href]/mal:info"/>
1363 <a class="ex-gnome-top">
1364 <xsl:attribute name="href">
1365 <xsl:call-template name="mal.link.target">
1366 <xsl:with-param name="node" select="$node"/>
1367 <xsl:with-param name="xref" select="$link/@xref"/>
1368 <xsl:with-param name="href" select="$link/@href"/>
1369 </xsl:call-template>
1370 </xsl:attribute>
1371 <xsl:attribute name="title">
1372 <xsl:call-template name="mal.link.tooltip">
1373 <xsl:with-param name="node" select="$node"/>
1374 <xsl:with-param name="xref" select="$link/@xref"/>
1375 <xsl:with-param name="href" select="$link/@href"/>
1376 <xsl:with-param name="role" select="$role"/>
1377 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1378 </xsl:call-template>
1379 </xsl:attribute>
1380 <span class="ex-gnome-top-banner"></span>
1381 <span class="ex-gnome-top-text">
1382 <span class="ex-gnome-top-title">
1383 <xsl:call-template name="mal.link.content">
1384 <xsl:with-param name="node" select="$node"/>
1385 <xsl:with-param name="xref" select="$link/@xref"/>
1386 <xsl:with-param name="href" select="$link/@href"/>
1387 <xsl:with-param name="role" select="$role"/>
1388 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1389 </xsl:call-template>
1390 </span>
1391 <xsl:if test="not(contains(concat(' ', $node/@style, ' '), ' nodesc '))">
1392 <xsl:variable name="desc">
1393 <xsl:call-template name="mal.link.desc">
1394 <xsl:with-param name="node" select="$node"/>
1395 <xsl:with-param name="xref" select="$link/@xref"/>
1396 <xsl:with-param name="href" select="$link/@href"/>
1397 <xsl:with-param name="role" select="$role"/>
1398 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1399 </xsl:call-template>
1400 </xsl:variable>
1401 <xsl:variable name="desc_" select="exsl:node-set($desc)/node()"/>
1402 <xsl:if test="$desc_">
1403 <span class="linkdiv-dash">
1404 <xsl:text> &#x2014; </xsl:text>
1405 </span>
1406 <span class="ex-gnome-top-desc">
1407 <xsl:apply-templates mode="_mal2html.links.divs.nolink.mode"
1408 select="$desc_"/>
1409 </span>
1410 </xsl:if>
1411 </xsl:if>
1412 </span>
1413 </a>
1414 </div>
1415 </xsl:for-each>
1416 </xsl:for-each>
1417 <!-- blank tiles for homogeneous sizing -->
1418 <div class="tile2"></div>
1419 </div>
1420 </xsl:template>
1421
1422
1423 <!--#* _mal2html.links.divs -->
1424 <xsl:template name="_mal2html.links.divs">
1425 <xsl:param name="node" select="."/>
1426 <xsl:param name="links"/>
1427 <xsl:param name="role" select="''"/>
1428 <xsl:param name="nodesc" select="false()"/>
1429 <xsl:param name="min" select="-1"/>
1430 <xsl:param name="max" select="-1"/>
1431 <div class="links-divs">
1432 <xsl:for-each select="$links">
1433 <xsl:sort data-type="number" select="@groupsort"/>
1434 <xsl:sort select="mal:title[@type = 'sort']"/>
1435 <xsl:if test="($max = -1 or position() &lt;= $max) and
1436 ($min = -1 or position() &gt; $min)">
1437 <xsl:variable name="link" select="."/>
1438 <xsl:variable name="xref" select="@xref"/>
1439 <xsl:for-each select="$mal.cache">
1440 <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
1441 <div class="linkdiv {$link/@class}">
1442 <xsl:for-each select="$link/@*">
1443 <xsl:if test="starts-with(name(.), 'data-')">
1444 <xsl:copy-of select="."/>
1445 </xsl:if>
1446 </xsl:for-each>
1447 <a class="linkdiv">
1448 <xsl:attribute name="href">
1449 <xsl:call-template name="mal.link.target">
1450 <xsl:with-param name="node" select="$node"/>
1451 <xsl:with-param name="xref" select="$target/@id"/>
1452 <xsl:with-param name="href" select="$link/@href"/>
1453 </xsl:call-template>
1454 </xsl:attribute>
1455 <xsl:attribute name="title">
1456 <xsl:call-template name="mal.link.tooltip">
1457 <xsl:with-param name="node" select="$node"/>
1458 <xsl:with-param name="xref" select="$target/@id"/>
1459 <xsl:with-param name="href" select="$link/@href"/>
1460 <xsl:with-param name="role" select="$role"/>
1461 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1462 </xsl:call-template>
1463 </xsl:attribute>
1464 <span class="title">
1465 <xsl:call-template name="mal.link.content">
1466 <xsl:with-param name="node" select="$node"/>
1467 <xsl:with-param name="xref" select="$target/@id"/>
1468 <xsl:with-param name="href" select="$link/@href"/>
1469 <xsl:with-param name="role" select="$role"/>
1470 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1471 </xsl:call-template>
1472 <xsl:call-template name="mal2html.editor.badge">
1473 <xsl:with-param name="target" select="$target"/>
1474 </xsl:call-template>
1475 </span>
1476 <xsl:if test="not($nodesc)">
1477 <xsl:variable name="desc">
1478 <xsl:call-template name="mal.link.desc">
1479 <xsl:with-param name="node" select="$node"/>
1480 <xsl:with-param name="xref" select="$xref"/>
1481 <xsl:with-param name="href" select="$link/@href"/>
1482 <xsl:with-param name="role" select="$role"/>
1483 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1484 </xsl:call-template>
1485 </xsl:variable>
1486 <xsl:variable name="desc_" select="exsl:node-set($desc)"/>
1487 <xsl:if test="$desc_/node()">
1488 <span class="linkdiv-dash">
1489 <xsl:text> &#x2014; </xsl:text>
1490 </span>
1491 <span class="desc">
1492 <xsl:apply-templates mode="_mal2html.links.divs.nolink.mode"
1493 select="$desc_"/>
1494 </span>
1495 </xsl:if>
1496 </xsl:if>
1497 </a>
1498 </div>
1499 </xsl:for-each>
1500 </xsl:if>
1501 </xsl:for-each>
1502 </div>
1503 </xsl:template>
1504
1505 <!--#% _mal2html.links.divs.nolink.mode -->
1506 <xsl:template mode="_mal2html.links.divs.nolink.mode" match="*">
1507 <xsl:copy>
1508 <xsl:copy-of select="@*"/>
1509 <xsl:apply-templates mode="_mal2html.links.divs.nolink.mode" select="node()"/>
1510 </xsl:copy>
1511 </xsl:template>
1512
1513 <xsl:template mode="_mal2html.links.divs.nolink.mode" match="*[@href]">
1514 <xsl:apply-templates mode="_mal2html.links.divs.nolink.mode" select="node()"/>
1515 </xsl:template>
1516
1517
1518 <!--#* _mal2html.links.button -->
1519 <xsl:template name="_mal2html.links.button">
1520 <xsl:param name="node" select="."/>
1521 <xsl:param name="links"/>
1522 <xsl:param name="role" select="''"/>
1523 <xsl:param name="nodesc" select="false()"/>
1524 <xsl:for-each select="$links">
1525 <xsl:sort data-type="number" select="@groupsort"/>
1526 <xsl:sort select="mal:title[@type = 'sort']"/>
1527 <xsl:variable name="link" select="."/>
1528 <xsl:variable name="xref" select="@xref"/>
1529 <xsl:for-each select="$mal.cache">
1530 <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
1531 <div class="link-button {$link/@class}">
1532 <xsl:for-each select="$link/@*">
1533 <xsl:if test="starts-with(name(.), 'data-')">
1534 <xsl:copy-of select="."/>
1535 </xsl:if>
1536 </xsl:for-each>
1537 <a>
1538 <xsl:attribute name="href">
1539 <xsl:call-template name="mal.link.target">
1540 <xsl:with-param name="node" select="$node"/>
1541 <xsl:with-param name="xref" select="$target/@id"/>
1542 <xsl:with-param name="href" select="$link/@href"/>
1543 </xsl:call-template>
1544 </xsl:attribute>
1545 <xsl:attribute name="title">
1546 <xsl:call-template name="mal.link.tooltip">
1547 <xsl:with-param name="node" select="$node"/>
1548 <xsl:with-param name="xref" select="$target/@id"/>
1549 <xsl:with-param name="href" select="$link/@href"/>
1550 <xsl:with-param name="role" select="$role"/>
1551 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1552 </xsl:call-template>
1553 </xsl:attribute>
1554 <span class="title">
1555 <xsl:call-template name="mal.link.content">
1556 <xsl:with-param name="node" select="$node"/>
1557 <xsl:with-param name="xref" select="$target/@id"/>
1558 <xsl:with-param name="href" select="$link/@href"/>
1559 <xsl:with-param name="role" select="$role"/>
1560 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1561 </xsl:call-template>
1562 <xsl:call-template name="mal2html.editor.badge">
1563 <xsl:with-param name="target" select="$target"/>
1564 </xsl:call-template>
1565 </span>
1566 <xsl:if test="not($nodesc)">
1567 <xsl:variable name="desc">
1568 <xsl:call-template name="mal.link.desc">
1569 <xsl:with-param name="node" select="$node"/>
1570 <xsl:with-param name="xref" select="$xref"/>
1571 <xsl:with-param name="href" select="$link/@href"/>
1572 <xsl:with-param name="role" select="$role"/>
1573 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1574 </xsl:call-template>
1575 </xsl:variable>
1576 <xsl:variable name="desc_" select="exsl:node-set($desc)"/>
1577 <xsl:if test="$desc_/node()">
1578 <span class="linkdiv-dash">
1579 <xsl:text> &#x2014; </xsl:text>
1580 </span>
1581 <span class="desc">
1582 <xsl:apply-templates mode="_mal2html.links.divs.nolink.mode"
1583 select="$desc_"/>
1584 </span>
1585 </xsl:if>
1586 </xsl:if>
1587 </a>
1588 </div>
1589 </xsl:for-each>
1590 </xsl:for-each>
1591 </xsl:template>
1592
1593
1594 <!--#* _mal2html.links.heading -->
1595 <xsl:template name="_mal2html.links.heading">
1596 <xsl:param name="node" select="."/>
1597 <xsl:param name="links" select="/false"/>
1598 <xsl:param name="role" select="''"/>
1599 <xsl:param name="nodesc" select="false()"/>
1600 <ul class="links-heading">
1601 <xsl:for-each select="$links">
1602 <xsl:sort data-type="number" select="@groupsort"/>
1603 <xsl:sort select="mal:title[@type = 'sort']"/>
1604 <xsl:variable name="link" select="."/>
1605 <xsl:variable name="xref" select="@xref"/>
1606 <xsl:for-each select="$mal.cache">
1607 <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
1608 <li class="links {$link/@class}">
1609 <xsl:for-each select="$link/@*">
1610 <xsl:if test="starts-with(name(.), 'data-')">
1611 <xsl:copy-of select="."/>
1612 </xsl:if>
1613 </xsl:for-each>
1614 <div class="links-heading">
1615 <a>
1616 <xsl:attribute name="href">
1617 <xsl:call-template name="mal.link.target">
1618 <xsl:with-param name="node" select="$node"/>
1619 <xsl:with-param name="xref" select="$xref"/>
1620 <xsl:with-param name="href" select="$link/@href"/>
1621 </xsl:call-template>
1622 </xsl:attribute>
1623 <xsl:attribute name="title">
1624 <xsl:call-template name="mal.link.tooltip">
1625 <xsl:with-param name="node" select="$node"/>
1626 <xsl:with-param name="xref" select="$xref"/>
1627 <xsl:with-param name="href" select="$link/@href"/>
1628 <xsl:with-param name="role" select="$role"/>
1629 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1630 </xsl:call-template>
1631 </xsl:attribute>
1632 <xsl:call-template name="mal.link.content">
1633 <xsl:with-param name="node" select="$node"/>
1634 <xsl:with-param name="xref" select="$xref"/>
1635 <xsl:with-param name="href" select="$link/@href"/>
1636 <xsl:with-param name="role" select="$role"/>
1637 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1638 </xsl:call-template>
1639 </a>
1640 <xsl:call-template name="mal2html.editor.badge">
1641 <xsl:with-param name="target" select="$target"/>
1642 </xsl:call-template>
1643 </div>
1644 <xsl:if test="not($nodesc)">
1645 <xsl:variable name="desc">
1646 <xsl:call-template name="mal.link.desc">
1647 <xsl:with-param name="node" select="$node"/>
1648 <xsl:with-param name="xref" select="$xref"/>
1649 <xsl:with-param name="href" select="$link/@href"/>
1650 <xsl:with-param name="role" select="$role"/>
1651 <xsl:with-param name="info" select="$link[@href]/mal:info"/>
1652 </xsl:call-template>
1653 </xsl:variable>
1654 <xsl:if test="exsl:node-set($desc)/node()">
1655 <div class="desc">
1656 <xsl:copy-of select="$desc"/>
1657 </div>
1658 </xsl:if>
1659 </xsl:if>
1660 </li>
1661 </xsl:for-each>
1662 </xsl:for-each>
1663 </ul>
1664 </xsl:template>
1665
1666 </xsl:stylesheet>