~ubuntu-branches/ubuntu/lucid/gnome-doc-utils/lucid

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-12-19 08:34:21 UTC
  • mto: (2.1.1 etch) (1.1.18 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20051219083421-k72rkh3n6vox1c0t
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version='1.0' encoding='utf-8'?><!-- -*- indent-tabs-mode: nil -*- -->
 
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
-->
2
18
 
3
19
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
20
                xmlns:doc="http://www.gnome.org/~shaunm/xsldoc"
 
21
                xmlns:msg="http://www.gnome.org/~shaunm/gnome-doc-utils/l10n"
5
22
                xmlns="http://www.w3.org/1999/xhtml"
6
23
                exclude-result-prefixes="doc"
7
24
                version="1.0">
65
82
    Format a block-level element
66
83
  </purpose>
67
84
  <parameter>
 
85
    <name>indent</name>
 
86
    <purpose>
 
87
      Whether this block should be indented
 
88
    </purpose>
 
89
  </parameter>
 
90
  <parameter>
68
91
    <name>verbatim</name>
69
92
    <purpose>
70
93
      Whether to maintain whitespace verbatim
73
96
</template>
74
97
 
75
98
<xsl:template name="db2html.block">
 
99
  <xsl:param name="indent" select="false()"/>
76
100
  <xsl:param name="verbatim" select="false()"/>
77
 
 
78
 
  <div class="{local-name(.)}">
 
101
  <div>
 
102
    <xsl:attribute name="class">
 
103
      <xsl:value-of select="local-name(.)"/>
 
104
      <xsl:if test="$indent">
 
105
        <xsl:text> block-indent</xsl:text>
 
106
      </xsl:if>
 
107
      <xsl:if test="$verbatim">
 
108
        <xsl:text> block-verbatim</xsl:text>
 
109
      </xsl:if>
 
110
    </xsl:attribute>
79
111
    <xsl:call-template name="db2html.anchor"/>
80
 
    <xsl:choose>
81
 
      <xsl:when test="$verbatim">
82
 
        <xsl:variable name="style">
83
 
          <xsl:if test="$verbatim">
84
 
            <xsl:text>white-space: pre; </xsl:text>
85
 
          </xsl:if>
86
 
        </xsl:variable>
87
 
        <xsl:attribute name="style">
88
 
          <xsl:value-of select="$style"/>
89
 
        </xsl:attribute>
90
 
        <xsl:apply-templates/>
91
 
      </xsl:when>
92
 
      <xsl:otherwise>
93
 
        <xsl:apply-templates/>
94
 
      </xsl:otherwise>
95
 
    </xsl:choose>
 
112
    <xsl:apply-templates/>
96
113
  </div>
97
114
</xsl:template>
98
115
 
107
124
</template>
108
125
 
109
126
<xsl:template name="db2html.blockquote">
110
 
  <div class="{local-name(.)}">
 
127
  <div class="{local-name(.)} block-indent">
111
128
    <xsl:apply-templates select="title"/>
112
129
    <blockquote class="{local-name(.)}">
113
130
      <xsl:apply-templates
142
159
  <purpose>
143
160
    Format an element in a <xmltag>pre</xmltag> tag
144
161
  </purpose>
 
162
  <parameter>
 
163
    <name>indent</name>
 
164
    <purpose>
 
165
      Whether this block should be indented
 
166
    </purpose>
 
167
  </parameter>
145
168
</template>
146
169
 
147
170
<xsl:template name="db2html.pre">
 
171
  <xsl:param name="indent" select="false()"/>
148
172
  <!-- FIXME:
149
173
  @width
150
174
  @language
152
176
  @format
153
177
  @startinglinenumber
154
178
  -->
155
 
  <div class="{local-name(.)}">
 
179
  <div>
 
180
    <xsl:attribute name="class">
 
181
      <xsl:value-of select="local-name(.)"/>
 
182
      <xsl:if test="$indent">
 
183
        <xsl:text> block-indent</xsl:text>
 
184
      </xsl:if>
 
185
    </xsl:attribute>
156
186
    <xsl:call-template name="db2html.anchor"/>
157
187
    <xsl:if test="@linenumbering = 'numbered'">
158
188
      <pre class="linenumbering" style="float: left; text-align: right;"><xsl:call-template name="db.linenumbering"/></pre>
199
229
 
200
230
<xsl:template name="db2html.block.css">
201
231
  <xsl:text>
202
 
    div[class~="figure"] { margin-left: 2em; margin-right: 1em; }
 
232
    *[class~="block-indent"] {
 
233
      margin-left: 1.72em;
 
234
      margin-right: 1em;
 
235
    }
 
236
    *[class~="block-indent"] *[class~="block-indent"] {
 
237
      margin-left: 0em;
 
238
      margin-right: 0em;
 
239
    }
 
240
    *[class~="block-verbatim"] {
 
241
      white-space: pre;
 
242
    }
203
243
    pre[class~="programlisting"] {
204
 
      margin-left: 2em;
205
 
      margin-right: 1em;
206
244
      padding: 6px;
207
245
      -moz-border-radius: 8px;
208
246
      overflow: auto;</xsl:text>
218
256
      <xsl:text>
219
257
    }
220
258
    pre[class~="screen"] {
221
 
      margin-left: 2em;
222
 
      margin-right: 1em;
223
259
      padding: 6px;
224
260
      -moz-border-radius: 8px;
225
261
      overflow: auto;</xsl:text>
235
271
      <xsl:text>
236
272
    }
237
273
    pre[class~="synopsis"] {
238
 
      margin-left: 2em;
239
 
      margin-right: 1em;
240
274
      overflow: auto;
241
275
    }
242
276
    pre[class~="linenumbering"] {
243
277
      <!-- This margin is important to get the line numbering
244
278
      to line up vertically with the content. -->
 
279
      padding-top: 6px;
 
280
      padding-bottom: 6px;
 
281
      -moz-border-radius: 8px;
 
282
      border: solid 1px black;
245
283
      margin-top: 0px;
246
 
      margin-left: 0.8em;
 
284
      margin-left: 0.83em;
247
285
      background-color: black;
248
286
      color: white;
249
287
      -moz-opacity: .3;
250
288
      padding-right: 0.4em;
251
289
      padding-left: 0.4em;
252
290
    }
253
 
    blockquote[class~="blockquote"] { margin-left: 2em; margin-right: 1em; }
254
291
    dt[class~="glossterm"] { margin-left: 0em; }
255
 
    dd + dt[class~="glossterm"] { margin-top: 1em; }
256
 
    dd[class~="glossdef"]     { margin-top: 0.5em; margin-left: 2em; margin-right: 1em; }
257
 
    dd[class~="glosssee"]     { margin-top: 0.5em; margin-left: 2em; margin-right: 1em; }
258
 
    dd[class~="glossseealso"] { margin-top: 0.5em; margin-left: 2em; margin-right: 1em; }
 
292
    dd + dt[class~="glossterm"] { margin-top: 2em; }
 
293
    dd[class~="glossdef"]
 
294
      { margin-top: 1em; margin-left: 2em; margin-right: 1em; }
 
295
    dd[class~="glosssee"]
 
296
      { margin-top: 1em; margin-left: 2em; margin-right: 1em; }
 
297
    dd[class~="glossseealso"]
 
298
      { margin-top: 1em; margin-left: 2em; margin-right: 1em; }
259
299
  </xsl:text>
260
300
</xsl:template>
261
301
 
306
346
 
307
347
<!-- = example = -->
308
348
<xsl:template match="example">
309
 
  <xsl:call-template name="db2html.block"/>
 
349
  <xsl:call-template name="db2html.block">
 
350
    <xsl:with-param name="indent" select="true()"/>
 
351
  </xsl:call-template>
310
352
</xsl:template>
311
353
 
312
354
<!-- = figure = -->
313
355
<xsl:template match="figure">
 
356
  <xsl:call-template name="db2html.block">
 
357
    <xsl:with-param name="indent" select="true()"/>
 
358
  </xsl:call-template>
 
359
</xsl:template>
 
360
 
 
361
<!-- = formalpara = -->
 
362
<xsl:template match="formalpara">
314
363
  <xsl:call-template name="db2html.block"/>
315
364
</xsl:template>
316
365
 
319
368
  <dd class="glossdef">
320
369
    <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
321
370
  </dd>
322
 
  <xsl:apply-templates select="glossseealso"/>
 
371
  <xsl:apply-templates select="glossseealso[1]"/>
323
372
</xsl:template>
324
373
 
325
374
<!-- = glossentry = -->
327
376
  <dt class="glossterm">
328
377
    <xsl:apply-templates select="glossterm"/>
329
378
  </dt>
330
 
  <xsl:apply-templates select="glossdef | glosssee"/>
 
379
  <xsl:apply-templates select="glossdef | glosssee[1]"/>
331
380
</xsl:template>
332
381
 
333
382
<!-- = glosssee = -->
334
 
<xsl:template match="glosssee">
335
 
  <!-- FIXME: this i18n sucks badly -->
336
 
  <dd class="glosssee">
 
383
<xsl:template match="glosssee | glossseealso">
 
384
  <dd class="{local-name(.)}">
337
385
    <p>
338
 
      <xsl:call-template name="gettext">
339
 
        <xsl:with-param name="msgid" select="'See'"/>
 
386
      <xsl:call-template name="l10n.gettext">
 
387
        <xsl:with-param name="msgid" select="concat(local-name(.), '.format')"/>
 
388
        <xsl:with-param name="node" select="."/>
 
389
        <xsl:with-param name="format" select="true()"/>
340
390
      </xsl:call-template>
341
 
      <xsl:text> </xsl:text>
342
 
      <xsl:choose>
343
 
        <xsl:when test="@otherterm">
344
 
          <xsl:call-template name="db2html.xref">
345
 
            <xsl:with-param name="linkend" select="@otherterm"/>
346
 
          </xsl:call-template>
347
 
        </xsl:when>
348
 
        <xsl:otherwise>
349
 
          <xsl:apply-templates/>
350
 
        </xsl:otherwise>
351
 
      </xsl:choose>
352
 
      <xsl:text>.</xsl:text>
353
391
    </p>
354
392
  </dd>
355
393
</xsl:template>
356
394
 
 
395
<xsl:template mode="l10n.format.mode" match="msg:glosssee">
 
396
  <xsl:param name="node"/>
 
397
  <xsl:for-each select="$node |
 
398
                        $node/following-sibling::*[name(.) = name($node)]">
 
399
    <xsl:if test="position() != 1">
 
400
      <xsl:call-template name="l10n.gettext">
 
401
        <xsl:with-param name="msgid" select="', '"/>
 
402
      </xsl:call-template>
 
403
    </xsl:if>
 
404
    <xsl:choose>
 
405
      <xsl:when test="@otherterm">
 
406
        <a>
 
407
          <xsl:attribute name="href">
 
408
            <xsl:call-template name="db.xref.target">
 
409
              <xsl:with-param name="linkend" select="@otherterm"/>
 
410
            </xsl:call-template>
 
411
          </xsl:attribute>
 
412
          <xsl:attribute name="title">
 
413
            <xsl:call-template name="db.xref.tooltip">
 
414
              <xsl:with-param name="linkend" select="@otherterm"/>
 
415
            </xsl:call-template>
 
416
          </xsl:attribute>
 
417
        </a>
 
418
        <xsl:choose>
 
419
          <xsl:when test="normalize-space(.) != ''">
 
420
            <xsl:apply-templates/>
 
421
          </xsl:when>
 
422
          <xsl:otherwise>
 
423
            <xsl:call-template name="db.xref.content">
 
424
              <xsl:with-param name="linkend" select="@otherterm"/>
 
425
              <xsl:with-param name="role" select="'glosssee'"/>
 
426
            </xsl:call-template>
 
427
          </xsl:otherwise>
 
428
        </xsl:choose>
 
429
      </xsl:when>
 
430
      <xsl:otherwise>
 
431
        <xsl:apply-templates/>
 
432
      </xsl:otherwise>
 
433
    </xsl:choose>
 
434
  </xsl:for-each>
 
435
</xsl:template>
 
436
 
357
437
<!-- = highlights = -->
358
438
<xsl:template match="highlights">
359
439
  <xsl:call-template name="db2html.block"/>
364
444
  <xsl:call-template name="db2html.block"/>
365
445
</xsl:template>
366
446
 
 
447
<!-- = informalexample = -->
 
448
<xsl:template match="informalexample">
 
449
  <xsl:call-template name="db2html.block"/>
 
450
</xsl:template>
 
451
 
367
452
<!-- = literallayout = -->
368
453
<xsl:template match="literallayout">
369
454
  <xsl:call-template name="db2html.block">
378
463
 
379
464
<!-- = programlisting = -->
380
465
<xsl:template match="programlisting">
381
 
  <xsl:call-template name="db2html.pre"/>
 
466
  <xsl:call-template name="db2html.pre">
 
467
    <xsl:with-param name="indent" select="true()"/>
 
468
  </xsl:call-template>
382
469
</xsl:template>
383
470
 
384
471
<!-- = screen = -->
385
472
<xsl:template match="screen">
386
 
  <xsl:call-template name="db2html.pre"/>
 
473
  <xsl:call-template name="db2html.pre">
 
474
    <xsl:with-param name="indent" select="true()"/>
 
475
  </xsl:call-template>
 
476
</xsl:template>
 
477
 
 
478
<!-- = simpara = -->
 
479
<xsl:template match="simpara">
 
480
  <xsl:call-template name="db2html.para"/>
387
481
</xsl:template>
388
482
 
389
483
<!-- = synopsis = -->
390
484
<xsl:template match="synopsis">
391
 
  <xsl:call-template name="db2html.pre"/>
 
485
  <xsl:call-template name="db2html.pre">
 
486
    <xsl:with-param name="indent" select="true()"/>
 
487
  </xsl:call-template>
392
488
</xsl:template>
393
489
 
394
490
</xsl:stylesheet>