~ubuntu-branches/ubuntu/vivid/yelp-xsl/vivid-proposed

« back to all changes in this revision

Viewing changes to xslt/docbook/html/db2html-index.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-11-29 10:00:13 UTC
  • Revision ID: james.westby@ubuntu.com-20101129100013-1fxze8fm1fegxl8w
Tags: upstream-2.31.6
ImportĀ upstreamĀ versionĀ 2.31.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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, write to the
 
15
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
16
02111-1307, USA.
 
17
-->
 
18
 
 
19
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
20
                xmlns:db="http://docbook.org/ns/docbook"
 
21
                                                                xmlns:msg="http://projects.gnome.org/yelp/gettext/"
 
22
                xmlns:set="http://exslt.org/sets"
 
23
                xmlns="http://www.w3.org/1999/xhtml"
 
24
                exclude-result-prefixes="db msg set"
 
25
                version="1.0">
 
26
 
 
27
<!--!!==========================================================================
 
28
DocBook to HTML - Indexes
 
29
:Requires: db-chunk db2html-division gettext
 
30
 
 
31
This module provides templates to process DocBook indexes.
 
32
-->
 
33
 
 
34
<!-- FIXME:
 
35
indexdiv
 
36
seeie
 
37
seealsoie
 
38
indexterm (autoidx)
 
39
-->
 
40
 
 
41
<!-- == Matched Templates == -->
 
42
 
 
43
<!-- = suppress = -->
 
44
<xsl:template match="primaryie | db:primaryie"/>
 
45
<xsl:template match="secondaryie | db:secondaryie"/>
 
46
<xsl:template match="tertiaryie | db:tertiaryie"/>
 
47
 
 
48
<!-- = indexentry = -->
 
49
<xsl:template match="indexentry | db:indexentry">
 
50
  <dt class="primaryie">
 
51
    <xsl:apply-templates select="primaryie/node() | db:primaryie/node()"/>
 
52
  </dt>
 
53
  <xsl:variable name="pri_see"
 
54
                select="seeie[not(preceding-sibling::secondaryie)] |
 
55
                        db:seeie[not(preceding-sibling::db:secondaryie)]"/>
 
56
  <xsl:variable name="pri_seealso"
 
57
                select="seealsoie[not(preceding-sibling::secondaryie)] |
 
58
                        db:seealsoie[not(preceding-sibling::db:secondaryie)]"/>
 
59
  <xsl:if test="$pri_see">
 
60
    <dd class="see">
 
61
      <xsl:call-template name="l10n.gettext">
 
62
        <xsl:with-param name="msgid" select="'seeie.format'"/>
 
63
        <xsl:with-param name="node" select="$pri_see"/>
 
64
        <xsl:with-param name="format" select="true()"/>
 
65
      </xsl:call-template>
 
66
    </dd>
 
67
  </xsl:if>
 
68
  <xsl:if test="$pri_seealso">
 
69
    <dd class="seealso">
 
70
      <xsl:call-template name="l10n.gettext">
 
71
        <xsl:with-param name="msgid" select="'seealsoie.format'"/>
 
72
        <xsl:with-param name="node" select="$pri_seealso"/>
 
73
        <xsl:with-param name="format" select="true()"/>
 
74
      </xsl:call-template>
 
75
    </dd>
 
76
  </xsl:if>
 
77
  <xsl:for-each select="secondaryie | db:secondaryie">
 
78
    <dd class="seconary">
 
79
      <dl class="secondary">
 
80
        <dt class="secondaryie">
 
81
          <xsl:apply-templates/>
 
82
        </dt>
 
83
        <xsl:variable name="sec_see"
 
84
                      select="following-sibling::seeie
 
85
                                [set:has-same-node(preceding-sibling::secondaryie[1], current())] |
 
86
                              following-sibling::db:seeie
 
87
                                [set:has-same-node(preceding-sibling::db:secondaryie[1], current())]"/>
 
88
        <xsl:variable name="sec_seealso"
 
89
                      select="following-sibling::seealsoie
 
90
                                [set:has-same-node(preceding-sibling::secondaryie[1], current())] |
 
91
                              following-sibling::db:seealsoie
 
92
                                [set:has-same-node(preceding-sibling::db:secondaryie[1], current())]"/>
 
93
        <xsl:variable name="tertiary"
 
94
                      select="following-sibling::tertiaryie
 
95
                                [set:has-same-node(preceding-sibling::secondaryie[1], current())] |
 
96
                              following-sibling::db:tertiaryie
 
97
                                [set:has-same-node(preceding-sibling::db:secondaryie[1], current())]"/>
 
98
        <xsl:if test="$sec_see">
 
99
          <dd class="see">
 
100
            <xsl:call-template name="l10n.gettext">
 
101
              <xsl:with-param name="msgid" select="'seeie.format'"/>
 
102
              <xsl:with-param name="node" select="$sec_see"/>
 
103
              <xsl:with-param name="format" select="true()"/>
 
104
            </xsl:call-template>
 
105
          </dd>
 
106
        </xsl:if>
 
107
        <xsl:if test="$sec_seealso">
 
108
          <dd class="seealso">
 
109
            <xsl:call-template name="l10n.gettext">
 
110
              <xsl:with-param name="msgid" select="'seealsoie.format'"/>
 
111
              <xsl:with-param name="node" select="$sec_seealso"/>
 
112
              <xsl:with-param name="format" select="true()"/>
 
113
            </xsl:call-template>
 
114
          </dd>
 
115
        </xsl:if>
 
116
        <xsl:if test="$tertiary">
 
117
          <!-- FIXME -->
 
118
        </xsl:if>
 
119
      </dl>
 
120
    </dd>
 
121
  </xsl:for-each>
 
122
</xsl:template>
 
123
 
 
124
<!-- = index = -->
 
125
<xsl:template match="index | db:index">
 
126
  <xsl:param name="depth_in_chunk">
 
127
    <xsl:call-template name="db.chunk.depth-in-chunk"/>
 
128
  </xsl:param>
 
129
  <xsl:param name="depth_of_chunk">
 
130
    <xsl:call-template name="db.chunk.depth-of-chunk"/>
 
131
  </xsl:param>
 
132
  <xsl:choose>
 
133
    <xsl:when test="not(title) and not(indexinfo/title) and not(db:title) and
 
134
                    not(db:info/db:title)">
 
135
      <xsl:call-template name="db2html.division.div">
 
136
        <xsl:with-param name="info" select="indexinfo | db:info"/>
 
137
        <xsl:with-param name="divisions" select="indexdiv | db:indexdiv"/>
 
138
        <xsl:with-param name="entries" select="indexentry | db:indexentry"/>
 
139
        <xsl:with-param name="title_content">
 
140
          <xsl:call-template name="l10n.gettext">
 
141
            <xsl:with-param name="msgid" select="'Index'"/>
 
142
          </xsl:call-template>
 
143
        </xsl:with-param>
 
144
        <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
 
145
        <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
 
146
      </xsl:call-template>
 
147
    </xsl:when>
 
148
    <xsl:otherwise>
 
149
      <xsl:call-template name="db2html.division.div">
 
150
        <xsl:with-param name="info" select="indexinfo | db:info"/>
 
151
        <xsl:with-param name="divisions" select="indexdiv | db:indexdiv"/>
 
152
        <xsl:with-param name="entries" select="indexentry | db:indexentry"/>
 
153
        <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
 
154
        <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
 
155
      </xsl:call-template>
 
156
    </xsl:otherwise>
 
157
  </xsl:choose>
 
158
</xsl:template>
 
159
 
 
160
<!-- = setindex = -->
 
161
<xsl:template match="setindex | db:setindex">
 
162
  <xsl:param name="depth_in_chunk">
 
163
    <xsl:call-template name="db.chunk.depth-in-chunk"/>
 
164
  </xsl:param>
 
165
  <xsl:param name="depth_of_chunk">
 
166
    <xsl:call-template name="db.chunk.depth-of-chunk"/>
 
167
  </xsl:param>
 
168
  <xsl:choose>
 
169
    <xsl:when test="not(title) and not(setindexinfo/title) and not(db:title) and
 
170
                    not(db:info/db:title)">
 
171
      <xsl:call-template name="db2html.division.div">
 
172
        <xsl:with-param name="info" select="setindexinfo | db:info"/>
 
173
        <xsl:with-param name="divisions" select="indexdiv | db:indexdiv"/>
 
174
        <xsl:with-param name="entries" select="indexentry | db:indexentry"/>
 
175
        <xsl:with-param name="title_content">
 
176
          <xsl:call-template name="l10n.gettext">
 
177
            <xsl:with-param name="msgid" select="'Index'"/>
 
178
          </xsl:call-template>
 
179
        </xsl:with-param>
 
180
        <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
 
181
        <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
 
182
      </xsl:call-template>
 
183
    </xsl:when>
 
184
    <xsl:otherwise>
 
185
      <xsl:call-template name="db2html.division.div">
 
186
        <xsl:with-param name="info" select="setindexinfo | db:info"/>
 
187
        <xsl:with-param name="divisions" select="indexdiv | db:indexdiv"/>
 
188
        <xsl:with-param name="entries" select="indexentry | db:indexentry"/>
 
189
        <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
 
190
        <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
 
191
      </xsl:call-template>
 
192
    </xsl:otherwise>
 
193
  </xsl:choose>
 
194
</xsl:template>
 
195
 
 
196
<!--#% l10n.format.mode -->
 
197
<xsl:template mode="l10n.format.mode" match="msg:seeie">
 
198
  <xsl:param name="node"/>
 
199
  <xsl:for-each select="$node">
 
200
    <xsl:if test="position() != 1">
 
201
      <xsl:call-template name="l10n.gettext">
 
202
        <xsl:with-param name="msgid" select="', '"/>
 
203
      </xsl:call-template>
 
204
    </xsl:if>
 
205
    <xsl:value-of select="."/>
 
206
<!--
 
207
    <xsl:choose>
 
208
      <xsl:when test="@otherterm">
 
209
        <a>
 
210
          <xsl:attribute name="href">
 
211
            <xsl:call-template name="db.xref.target">
 
212
              <xsl:with-param name="linkend" select="@otherterm"/>
 
213
            </xsl:call-template>
 
214
          </xsl:attribute>
 
215
          <xsl:attribute name="title">
 
216
            <xsl:call-template name="db.xref.tooltip">
 
217
              <xsl:with-param name="linkend" select="@otherterm"/>
 
218
            </xsl:call-template>
 
219
          </xsl:attribute>
 
220
          <xsl:choose>
 
221
            <xsl:when test="normalize-space(.) != ''">
 
222
              <xsl:apply-templates/>
 
223
            </xsl:when>
 
224
            <xsl:otherwise>
 
225
              <xsl:call-template name="db.xref.content">
 
226
                <xsl:with-param name="linkend" select="@otherterm"/>
 
227
                <xsl:with-param name="role" select="'glosssee'"/>
 
228
              </xsl:call-template>
 
229
            </xsl:otherwise>
 
230
          </xsl:choose>
 
231
        </a>
 
232
      </xsl:when>
 
233
      <xsl:otherwise>
 
234
        <xsl:apply-templates/>
 
235
      </xsl:otherwise>
 
236
    </xsl:choose>
 
237
-->
 
238
  </xsl:for-each>
 
239
</xsl:template>
 
240
 
 
241
</xsl:stylesheet>