1
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
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
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
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, write to the
15
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
20
xmlns:set="http://exslt.org/sets"
21
xmlns:xl="http://www.w3.org/1999/xlink"
22
xmlns:db="http://docbook.org/ns/docbook"
23
exclude-result-prefixes="db xl set"
26
<!--!!==========================================================================
28
:Requires: db-chunk db-title gettext
32
<!--**==========================================================================
34
Generates the tooltip for an external link
35
$node: The element to generate a tooltip for
36
$url: The URL of the link, usually from the #{url} attribute
38
<xsl:template name="db.ulink.tooltip">
39
<xsl:param name="node" select="."/>
40
<xsl:param name="url" select="$node/@url | $node/@xl:href"/>
42
<xsl:when test="starts-with($url, 'mailto:')">
43
<xsl:variable name="addy" select="substring-after($url, 'mailto:')"/>
44
<xsl:call-template name="l10n.gettext">
45
<xsl:with-param name="msgid" select="'email.tooltip'"/>
46
<xsl:with-param name="string" select="$addy"/>
47
<xsl:with-param name="format" select="true()"/>
51
<xsl:value-of select="normalize-space($url)"/>
57
<!--**==========================================================================
59
Generates the content of a cross reference
60
$linkend: The id of the linked-to element, usually from the #{linkend} attribute
61
$target: The linked-to element
62
$xrefstyle: The cross reference style, usually from the #{xrefstyle} attribute
64
REMARK: The xrefstyle/role stuff needs to be documented
66
<xsl:template name="db.xref.content">
67
<xsl:param name="linkend" select="@linkend"/>
68
<xsl:param name="target" select="key('idkey', $linkend)"/>
69
<xsl:param name="xrefstyle" select="@xrefstyle"/>
71
<xsl:when test="$xrefstyle = 'role:title'">
72
<xsl:call-template name="db.title">
73
<xsl:with-param name="node" select="$target"/>
76
<xsl:when test="$xrefstyle = 'role:titleabbrev'">
77
<xsl:call-template name="db.titleabbrev">
78
<xsl:with-param name="node" select="$target"/>
81
<xsl:when test="$xrefstyle = 'role:subtitle'">
82
<xsl:call-template name="db.subtitle">
83
<xsl:with-param name="node" select="$target"/>
86
<xsl:when test="$target/@xreflabel">
87
<xsl:value-of select="$target/@xreflabel"/>
90
<xsl:call-template name="db.title">
91
<xsl:with-param name="node" select="$target"/>
99
<!--**==========================================================================
101
Generates the target identifier of a cross reference
102
$linkend: The id of the linked-to element, usually from the #{linkend} attribute
103
$target: The linked-to element
104
$is_chunk: Whether ${target} is known to be a chunked element
106
REMARK: Talk about how this works with chunking
108
<xsl:template name="db.xref.target">
109
<xsl:param name="linkend" select="@linkend"/>
110
<xsl:param name="target" select="key('idkey', $linkend)"/>
111
<xsl:param name="is_chunk" select="false()"/>
113
<xsl:when test="$linkend = $db.chunk.info_basename">
115
select="concat($db.chunk.info_basename, $db.chunk.extension)"/>
117
<xsl:when test="set:has-same-node($target, /*)">
118
<xsl:value-of select="concat($db.chunk.basename, $db.chunk.extension)"/>
120
<xsl:when test="$is_chunk">
121
<xsl:value-of select="concat($linkend, $db.chunk.extension)"/>
124
<xsl:variable name="target_chunk_id">
125
<xsl:call-template name="db.chunk.chunk-id">
126
<xsl:with-param name="node" select="$target"/>
129
<xsl:value-of select="concat($target_chunk_id, $db.chunk.extension)"/>
130
<xsl:if test="string($linkend) != '' and string($target_chunk_id) != string($linkend)">
131
<xsl:value-of select="concat('#', $linkend)"/>
138
<!--**==========================================================================
140
Generates the tooltip for a cross reference
141
$linkend: The id of the linked-to element, usually from the #{linkend} attribute
142
$target: The linked-to element
144
REMARK: Document this
146
<xsl:template name="db.xref.tooltip">
147
<xsl:param name="linkend" select="@linkend"/>
148
<xsl:param name="target" select="key('idkey', $linkend)"/>
149
<xsl:apply-templates mode="db.xref.tooltip.mode" select="$target"/>
153
<!--%%==========================================================================
157
REMARK: Document this
159
<xsl:template mode="db.xref.tooltip.mode" match="*">
160
<xsl:call-template name="db.title">
161
<xsl:with-param name="node" select="."/>
165
<!-- = db.xref.tooltip.mode % biblioentry | bibliomixed = -->
166
<xsl:template mode="db.xref.tooltip.mode" match="biblioentry | bibliomixed |
167
db:biblioentry | db:bibliomixed ">
168
<xsl:call-template name="l10n.gettext">
169
<xsl:with-param name="msgid" select="'biblioentry.tooltip'"/>
170
<xsl:with-param name="node" select="."/>
171
<xsl:with-param name="format" select="true()"/>
175
<!-- = db.xref.tooltip.mode % glossentry = -->
176
<xsl:template mode="db.xref.tooltip.mode" match="glossentry | db:glossentry">
177
<xsl:call-template name="l10n.gettext">
178
<xsl:with-param name="msgid" select="'glossentry.tooltip'"/>
179
<xsl:with-param name="node" select="."/>
180
<xsl:with-param name="format" select="true()"/>