~ubuntu-branches/ubuntu/saucy/yelp/saucy-proposed

« back to all changes in this revision

Viewing changes to stylesheets/toc2html.xsl.in

  • Committer: Bazaar Package Importer
  • Author(s): Michael Terry
  • Date: 2011-06-28 04:56:30 UTC
  • mfrom: (1.1.48 upstream)
  • Revision ID: james.westby@ubuntu.com-20110628045630-55mwg7p3nhp4fmwb
Tags: 3.1.1-0ubuntu1
* New upstream release.
* Resync with Debian packaging, remaining Ubuntu changes:
  - Use source format 3
  - Add apport hook
  - Watch for unstable releases too
  - Suggest ttf-dejavu, instead of Recommend
  - Use autoreconf
  - debian/patches/00_no_am_gnu_gettext.patch
  - debian/patches/01_lpi.patch
  - debian/patches/05_menu_tooltip.patch

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
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
 
                xmlns:yelp="http://www.gnome.org/yelp/ns"
4
 
                xmlns="http://www.w3.org/1999/xhtml"
5
 
                extension-element-prefixes="yelp"
6
 
                version="1.0">
7
 
 
8
 
<xsl:import href="@XSL_GETTEXT@"/>
9
 
 
10
 
<xsl:param name="help_icon"/>
11
 
<xsl:param name="help_icon_size"/>
12
 
 
13
 
<xsl:param name="theme.color.text"/>
14
 
<xsl:param name="theme.color.background"/>
15
 
<xsl:param name="theme.color.text_light"/>
16
 
<xsl:param name="theme.color.link"/>
17
 
<xsl:param name="theme.color.link_visited"/>
18
 
<xsl:param name="theme.color.gray_background"/>
19
 
<xsl:param name="theme.color.gray_border"/>
20
 
<xsl:param name="theme.color.blue_background"/>
21
 
<xsl:param name="theme.color.blue_border"/>
22
 
<xsl:param name="theme.color.red_background"/>
23
 
<xsl:param name="theme.color.red_border"/>
24
 
<xsl:param name="theme.color.yellow_background"/>
25
 
<xsl:param name="theme.color.yellow_border"/>
26
 
 
27
 
<xsl:template match="toc">
28
 
  <xsl:variable name="direction">
29
 
    <xsl:call-template name="l10n.direction"/>
30
 
  </xsl:variable>
31
 
  <xsl:variable name="left">
32
 
    <xsl:call-template name="l10n.align.start">
33
 
      <xsl:with-param name="direction" select="$direction"/>
34
 
    </xsl:call-template>
35
 
  </xsl:variable>
36
 
  <xsl:variable name="right">
37
 
    <xsl:call-template name="l10n.align.end">
38
 
      <xsl:with-param name="direction" select="$direction"/>
39
 
    </xsl:call-template>
40
 
  </xsl:variable>
41
 
  <yelp:document href="{@id}">
42
 
    <html>
43
 
      <head>
44
 
        <title>
45
 
          <xsl:value-of select="title[1]"/>
46
 
        </title>
47
 
        <style type="text/css"><xsl:text>
48
 
        body {
49
 
          margin: 0px;
50
 
          padding: 0px;
51
 
        }
52
 
        h1 {
53
 
          font-size: 1.6em;
54
 
          margin-bottom: 0.4em;
55
 
          margin-top: 12px;
56
 
          margin-left: 12px;
57
 
          margin-right: 12px;
58
 
          padding-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 204px;
59
 
          padding-top: 0.2em;
60
 
          padding-bottom: 0.2em;
61
 
          -webkit-border-radius: 6px;
62
 
          border: solid 1px </xsl:text>
63
 
          <xsl:value-of select="$theme.color.blue_border"/><xsl:text>;
64
 
          background-color: </xsl:text>
65
 
          <xsl:value-of select="$theme.color.blue_background"/><xsl:text>;
66
 
          color: </xsl:text>
67
 
          <xsl:value-of select="$theme.color.text"/><xsl:text>;
68
 
        }
69
 
        h1 img {
70
 
          float: </xsl:text><xsl:value-of select="$right"/><xsl:text>;
71
 
          margin-</xsl:text><xsl:value-of select="$right"/><xsl:text>: 18px;
72
 
        }
73
 
        h2 h3 {
74
 
          color: </xsl:text><xsl:value-of select="$theme.color.text"/><xsl:text>;
75
 
        }
76
 
        div[class~="body"] { }
77
 
        div[class~="leftbar"] {
78
 
          position: absolute;
79
 
          top: 4em;
80
 
          </xsl:text><xsl:value-of select="$left"/><xsl:text>: 12px;
81
 
          width: 192px;
82
 
          min-height: 192px;
83
 
          text-align: </xsl:text><xsl:value-of select="$left"/><xsl:text>;
84
 
          /* padding-top: </xsl:text>
85
 
          <xsl:value-of select="$help_icon_size"/><xsl:text>px;
86
 
          background-image: url("</xsl:text>
87
 
          <xsl:value-of select="$help_icon"/><xsl:text>");
88
 
          background-position: </xsl:text>
89
 
          <xsl:value-of select="(192 - $help_icon_size) div 2"/><xsl:text>px 0px;
90
 
          background-repeat: no-repeat;
91
 
          opacity: .3; */
92
 
        }
93
 
        div[class~="leftbackground"] {
94
 
          position: absolute;
95
 
          top: 4em;
96
 
          </xsl:text><xsl:value-of select="$left"/><xsl:text>: 1px;
97
 
          width: 210px;
98
 
          min-height: 192px;
99
 
          text-align: center;
100
 
          padding-top: 0px;
101
 
          background-image:url("</xsl:text>
102
 
          <xsl:value-of select="$help_icon"/><xsl:text>");
103
 
          background-position: </xsl:text>
104
 
          <xsl:value-of select="(192 - $help_icon_size) div 2"/><xsl:text>px 0px;
105
 
 
106
 
          background-repeat: no-repeat;
107
 
          opacity: .1;          
108
 
        }
109
 
        div[class~="rightbar"] {
110
 
          margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 216px;
111
 
          margin-</xsl:text><xsl:value-of select="$right"/><xsl:text>: 12px;
112
 
          padding: 1em;
113
 
          background-color: </xsl:text><xsl:value-of select="$theme.color.background"/><xsl:text>;
114
 
          color: </xsl:text><xsl:value-of select="$theme.color.text"/><xsl:text>;
115
 
          -webkit-border-radius: 8px;
116
 
        }
117
 
        ul { margin-left: 0em; padding-left: 0em; }
118
 
        li[class~="toclist"] {
119
 
          margin-top: 0.3em;
120
 
          margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 0em;
121
 
          padding-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 0em;
122
 
          font-size: 1.2em;
123
 
          list-style-type: none;
124
 
        }
125
 
        li li[class~="toclist"] {
126
 
          padding-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 0.8em;
127
 
          font-size: 0.8em;
128
 
        }
129
 
        li li li[class~="toclist"] {
130
 
          padding-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 0.8em;
131
 
          font-size: 0.6em;
132
 
        }
133
 
        li[class~="toc"] {
134
 
          margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 0em;
135
 
          font-size: 1.2em;
136
 
          padding-top: 0.5em;
137
 
          list-style-type: none;
138
 
        }
139
 
        dl {
140
 
          margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 0em;
141
 
          padding-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 0em;
142
 
        }
143
 
        dt { font-size: 1.2em; margin-top: 1em; }
144
 
        dd {
145
 
          margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1em;
146
 
          margin-top: 0.5em;
147
 
        }
148
 
        a { text-decoration: none; color: </xsl:text><xsl:value-of select="$theme.color.link"/><xsl:text>; }
149
 
        a:hover { text-decoration: underline; }
150
 
        </xsl:text></style>
151
 
      </head>
152
 
      <body>
153
 
        <div>
154
 
          <xsl:if test="$direction = 'ltr' or $direction='rtl'">
155
 
            <xsl:attribute name="dir">
156
 
              <xsl:value-of select="$direction"/>
157
 
            </xsl:attribute>
158
 
          </xsl:if>
159
 
          <xsl:apply-templates mode="body.mode" select="."/>
160
 
        </div>
161
 
      </body>
162
 
    </html>
163
 
  </yelp:document>
164
 
</xsl:template>
165
 
 
166
 
<xsl:template name="print.documents">
167
 
  <div class="docs">
168
 
    <dl>
169
 
      <xsl:for-each select="doc">
170
 
        <xsl:sort order="ascending" data-type="number"
171
 
          select="normalize-space(@weight)"/>
172
 
        <xsl:sort select="normalize-space(title)"/>
173
 
        <dt class="doc">
174
 
          <a href="{@href}" title="{@href}">
175
 
            <xsl:if test="tooltip">
176
 
              <xsl:attribute name="title">
177
 
                <xsl:value-of select="tooltip"/>
178
 
              </xsl:attribute>
179
 
            </xsl:if>
180
 
            <xsl:value-of select="title"/>
181
 
          </a>
182
 
        </dt>
183
 
        <dd>
184
 
          <xsl:value-of select="description"/>
185
 
        </dd>
186
 
      </xsl:for-each>
187
 
    </dl>
188
 
  </div>
189
 
</xsl:template>
190
 
 
191
 
<xsl:template name="print.subsections">
192
 
  <div class="tocs">
193
 
    <ul>
194
 
      <xsl:for-each select="toc[../@id = 'index' or .//doc]">
195
 
        <xsl:sort select="number(../@id = 'index') * position()"/>
196
 
        <xsl:sort select="normalize-space(title)"/>
197
 
        <li class="toc">
198
 
          <a href="x-yelp-toc:{@id}">
199
 
            <xsl:apply-templates select="title[1]/node()"/>
200
 
          </a>
201
 
        </li>
202
 
      </xsl:for-each>
203
 
    </ul>
204
 
  </div>
205
 
</xsl:template>
206
 
 
207
 
<xsl:template mode="body.mode" match="toc">
208
 
  <div class="leftbackground">
209
 
  </div>
210
 
  <div class="body">
211
 
    <h1>
212
 
      <xsl:if test="icon">
213
 
        <img src="{icon/@file}"/>
214
 
      </xsl:if>
215
 
      <xsl:apply-templates select="title"/>
216
 
    </h1>
217
 
    <div class="leftbar">
218
 
      <xsl:choose>
219
 
      <xsl:when test="@id= 'index'">
220
 
        <h2><xsl:value-of select="/toc/title"/></h2>
221
 
      </xsl:when>
222
 
      <xsl:otherwise>
223
 
        <a href="x-yelp-toc:index"><h2><xsl:value-of select="/toc/title"/>
224
 
      </h2></a>
225
 
      </xsl:otherwise>        
226
 
      </xsl:choose>
227
 
      <xsl:apply-templates mode="leftbar.mode" select="/toc">
228
 
        <xsl:with-param name="curid" select="@id"/>
229
 
      </xsl:apply-templates>
230
 
    </div>
231
 
    <div class="rightbar">
232
 
      <h3><xsl:apply-templates select="description/node()"/></h3>
233
 
      <xsl:choose>
234
 
        <!-- if there are documents and subsections, only print documents -->
235
 
        <xsl:when test="doc[1] and toc[.//doc[1]]">
236
 
          <xsl:call-template name="print.documents"/>
237
 
        </xsl:when>
238
 
        <!-- if there are documents, print them -->
239
 
        <xsl:when test="doc[1]">
240
 
          <xsl:call-template name="print.documents"/>
241
 
        </xsl:when>
242
 
        <!-- if there are subsections, print them -->
243
 
        <xsl:when test="toc[.//doc[1]]">
244
 
          <xsl:call-template name="print.subsections"/>
245
 
        </xsl:when>
246
 
        <xsl:otherwise>
247
 
          <h3>No documents or subcategories found.</h3>
248
 
        </xsl:otherwise>
249
 
      </xsl:choose>
250
 
    </div>
251
 
  </div>
252
 
</xsl:template>
253
 
 
254
 
<!-- tricky recursive xslt -->
255
 
<xsl:template mode="leftbar.mode" match="toc">
256
 
  <xsl:param name="curid" select="0"/>
257
 
    <ul>
258
 
      <xsl:for-each select="toc[.//doc[1] or @protected]">
259
 
        <li class="toclist">
260
 
          <xsl:choose>
261
 
            <xsl:when test="@id != $curid">
262
 
              <a href="x-yelp-toc:{@id}">
263
 
                <xsl:value-of select="title[1]/node()"/>
264
 
              </a>
265
 
            </xsl:when>
266
 
            <xsl:otherwise>
267
 
              <xsl:value-of select="title[1]/node()"/>
268
 
            </xsl:otherwise>
269
 
          </xsl:choose>
270
 
          <xsl:if test="@id = $curid or .//toc[@id = $curid]">
271
 
            <xsl:apply-templates mode="leftbar.mode" select=".">
272
 
              <xsl:with-param name="curid" select="$curid"/>
273
 
            </xsl:apply-templates>
274
 
          </xsl:if>
275
 
        </li>
276
 
      </xsl:for-each>
277
 
    </ul>
278
 
</xsl:template>
279
 
 
280
 
<xsl:template match="/">
281
 
  <xsl:apply-templates select="//toc" />
282
 
</xsl:template>
283
 
 
284
 
</xsl:stylesheet>