Debian Codegraph @

xslt/docbook/html/db2html-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:db="http://docbook.org/ns/docbook"
19 xmlns:set="http://exslt.org/sets"
20 xmlns="http://www.w3.org/1999/xhtml"
21 exclude-result-prefixes="db set"
22 version="1.0">
23
24 <!--!!==========================================================================
25 DocBook to HTML - Links
26 @revision[version=3.4 date=2011-11-08 status=final]
27
28 This stylesheet contains templates to handle implicit automatic links.
29 -->
30
31
32 <!--**==========================================================================
33 db2html.links.linktrail
34 Generate links to pages from ancestor elements.
35 @revision[version=3.20 date=2015-09-15 status=final]
36
37 [xsl:params]
38 $node: The element to generate links for.
39
40 This template outputs a trail of links for the ancestor pages of $node. If
41 $node has no ancestors, then it calls {html.linktrails.empty} instead. This
42 template calls {html.linktrails.prefix} before the first link, passing $node
43 as that template's `node` parameter.
44 -->
45 <xsl:template name="db2html.links.linktrail">
46 <xsl:param name="node" select="."/>
47 <xsl:variable name="direction">
48 <xsl:call-template name="l10n.direction">
49 <xsl:with-param name="node" select="$node"/>
50 </xsl:call-template>
51 </xsl:variable>
52 <xsl:choose>
53 <xsl:when test="$node/ancestor::*">
54 <div class="trails" role="navigation">
55 <div class="trail">
56 <xsl:call-template name="html.linktrails.prefix">
57 <xsl:with-param name="node" select="$node"/>
58 </xsl:call-template>
59 <!-- The parens put the nodes back in document order -->
60 <xsl:for-each select="($node/ancestor::*)">
61 <a class="trail">
62 <xsl:attribute name="href">
63 <xsl:call-template name="db.xref.target">
64 <xsl:with-param name="linkend" select="@id | @xml:id"/>
65 <xsl:with-param name="target" select="."/>
66 <xsl:with-param name="is_chunk" select="true()"/>
67 </xsl:call-template>
68 </xsl:attribute>
69 <xsl:attribute name="title">
70 <xsl:call-template name="db.xref.tooltip">
71 <xsl:with-param name="linkend" select="@id | @xml:id"/>
72 <xsl:with-param name="target" select="."/>
73 </xsl:call-template>
74 </xsl:attribute>
75 <xsl:call-template name="db.titleabbrev">
76 <xsl:with-param name="node" select="."/>
77 </xsl:call-template>
78 </a>
79 <xsl:choose>
80 <xsl:when test="$direction = 'rtl'">
81 <xsl:text>&#x200F;&#x00A0;» &#x200F;</xsl:text>
82 </xsl:when>
83 <xsl:otherwise>
84 <xsl:text>&#x00A0;» </xsl:text>
85 </xsl:otherwise>
86 </xsl:choose>
87 </xsl:for-each>
88 </div>
89 </div>
90 </xsl:when>
91 <xsl:otherwise>
92 <xsl:call-template name="html.linktrails.empty">
93 <xsl:with-param name="node" select="$node"/>
94 </xsl:call-template>
95 </xsl:otherwise>
96 </xsl:choose>
97 </xsl:template>
98
99
100 <!--**==========================================================================
101 db2html.links.next
102 Output links to the previous and next pages.
103 @revision[version=3.4 date=2011-11-08 status=final]
104
105 [xsl:params]
106 $node: The element to generate links for.
107 $depth_of_chunk: The depth of the containing chunk in the document.
108
109 This template outputs links to the previous and next pages, if they exist. It
110 calls {db.chunk.chunk-id.axis} to find the previous and next pages. The block
111 containing the links is end-floated by default. The links use the text "Previous"
112 and "Next", although the actual page titles are used for tooltips.
113 -->
114 <xsl:template name="db2html.links.next">
115 <xsl:param name="node" select="."/>
116 <xsl:param name="depth_of_chunk">
117 <xsl:call-template name="db.chunk.depth-of-chunk">
118 <xsl:with-param name="node" select="$node"/>
119 </xsl:call-template>
120 </xsl:param>
121 <xsl:variable name="prev_id">
122 <xsl:choose>
123 <xsl:when test="$depth_of_chunk = 0"/>
124 <xsl:otherwise>
125 <xsl:call-template name="db.chunk.chunk-id.axis">
126 <xsl:with-param name="node" select="$node"/>
127 <xsl:with-param name="axis" select="'previous'"/>
128 <xsl:with-param name="depth_in_chunk" select="0"/>
129 <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
130 </xsl:call-template>
131 </xsl:otherwise>
132 </xsl:choose>
133 </xsl:variable>
134 <xsl:variable name="next_id">
135 <xsl:call-template name="db.chunk.chunk-id.axis">
136 <xsl:with-param name="node" select="$node"/>
137 <xsl:with-param name="axis" select="'next'"/>
138 <xsl:with-param name="depth_in_chunk" select="0"/>
139 <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
140 </xsl:call-template>
141 </xsl:variable>
142 <xsl:variable name="prev_node" select="key('db.id.key', $prev_id)"/>
143 <xsl:variable name="next_node" select="key('db.id.key', $next_id)"/>
144 <nav class="prevnext pagewide"><div class="inner">
145 <xsl:if test="$prev_id != ''">
146 <a>
147 <xsl:attribute name="href">
148 <xsl:call-template name="db.xref.target">
149 <xsl:with-param name="linkend" select="$prev_id"/>
150 <xsl:with-param name="target" select="$prev_node"/>
151 <xsl:with-param name="is_chunk" select="true()"/>
152 </xsl:call-template>
153 </xsl:attribute>
154 <xsl:attribute name="title">
155 <xsl:call-template name="db.xref.tooltip">
156 <xsl:with-param name="linkend" select="$prev_id"/>
157 <xsl:with-param name="target" select="$prev_node"/>
158 </xsl:call-template>
159 </xsl:attribute>
160 <xsl:call-template name="l10n.gettext">
161 <xsl:with-param name="msgid" select="'Previous'"/>
162 </xsl:call-template>
163 </a>
164 </xsl:if>
165 <xsl:choose>
166 <xsl:when test="$next_id != ''">
167 <a>
168 <xsl:attribute name="href">
169 <xsl:call-template name="db.xref.target">
170 <xsl:with-param name="linkend" select="$next_id"/>
171 <xsl:with-param name="is_chunk" select="true()"/>
172 </xsl:call-template>
173 </xsl:attribute>
174 <xsl:attribute name="title">
175 <xsl:call-template name="db.xref.tooltip">
176 <xsl:with-param name="linkend" select="$next_id"/>
177 <xsl:with-param name="target" select="$next_node"/>
178 </xsl:call-template>
179 </xsl:attribute>
180 <xsl:call-template name="l10n.gettext">
181 <xsl:with-param name="msgid" select="'Next'"/>
182 </xsl:call-template>
183 </a>
184 </xsl:when>
185 <xsl:otherwise>
186 <span>
187 <xsl:call-template name="l10n.gettext">
188 <xsl:with-param name="msgid" select="'Next'"/>
189 </xsl:call-template>
190 </span>
191 </xsl:otherwise>
192 </xsl:choose>
193 </div></nav>
194 </xsl:template>
195
196
197 <!--**==========================================================================
198 db2html.links.section
199 Output links to subsections.
200 @revision[version=3.4 date=2011-11-08 status=final]
201
202 [xsl:params]
203 $node: The element to generate links for.
204 $divisions: The division-level child elements of $node to link to.
205
206 This template outputs links to the child division-level elements of $node,
207 whether or not they are chunked.
208 -->
209 <xsl:template name="db2html.links.section">
210 <xsl:param name="node" select="."/>
211 <xsl:param name="divisions" select="/false"/>
212 <xsl:if test="$divisions">
213 <div class="links sectionlinks" role="navigation">
214 <ul>
215 <xsl:for-each select="$divisions">
216 <li class="links">
217 <xsl:call-template name="db2html.xref">
218 <xsl:with-param name="linkend" select="@id | @xml:id"/>
219 <xsl:with-param name="target" select="."/>
220 <xsl:with-param name="xrefstyle" select="'role:titleabbrev'"/>
221 </xsl:call-template>
222 </li>
223 </xsl:for-each>
224 </ul>
225 </div>
226 </xsl:if>
227 </xsl:template>
228
229 </xsl:stylesheet>