This file is indexed.

/usr/share/yelp-xsl/xslt/docbook/html/db2html-media.xsl is in yelp-xsl 3.10.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
<!--
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any
later version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.

You should have received a copy of the GNU Lesser General Public License
along with this program; see the file COPYING.LGPL.  If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:db="http://docbook.org/ns/docbook"
                xmlns:mml="http://www.w3.org/1998/Math/MathML"
                xmlns:str="http://exslt.org/strings"
                xmlns="http://www.w3.org/1999/xhtml"
                exclude-result-prefixes="db mml str"
                version="1.0">

<!--!!==========================================================================
DocBook to HTML - Images and Media
Handle DocBook media elements.
:Revision:version="3.8" date="2012-11-13" status="final"

This stylesheet contains templates for handling DocBook #{mediaobject} and
#{inlinemediaobject} elements, as well as the various #{object} and #{data}
elements found in these elements. This stylesheet also handles the deprecated
DocBook 4 #{graphic} and #{inlinegraphic} elements.
-->


<!--**==========================================================================
db2html.audiodata
Output an HTML #{audio} element for a #{audiodata} element.
:Revision:version="3.8" date="2012-11-12" status="final"
$node: The #{audiodata} element.

This template creates an #{audio} element in the HTML output. This template
calls *{db2html.mediaobject.fallback} for the contents of the #{audio} element.
-->
<xsl:template name="db2html.audiodata">
  <xsl:param name="node" select="."/>
  <xsl:variable name="media" select="($node/ancestor::mediaobject[1] |
                                      $node/ancestor::inlinemediaobject[1] |
                                      $node/ancestor::db:mediaobject[1] |
                                      $node/ancestor::db:inlinemediaobject[1]
                                     )[last()]"/>
  <audio preload="auto" controls="controls">
    <xsl:attribute name="src">
      <xsl:choose>
        <xsl:when test="$node/@fileref">
          <xsl:value-of select="$node/@fileref"/>
        </xsl:when>
        <xsl:when test="$node/@entityref">
          <xsl:value-of select="unparsed-entity-uri($node/@entityref)"/>
        </xsl:when>
      </xsl:choose>
    </xsl:attribute>
    <xsl:attribute name="data-play-label">
      <xsl:call-template name="l10n.gettext">
        <xsl:with-param name="msgid" select="'Play'"/>
      </xsl:call-template>
    </xsl:attribute>
    <xsl:attribute name="data-pause-label">
      <xsl:call-template name="l10n.gettext">
        <xsl:with-param name="msgid" select="'Pause'"/>
      </xsl:call-template>
    </xsl:attribute>
    <xsl:call-template name="db2html.mediaobject.fallback">
      <xsl:with-param name="node" select="$media"/>
    </xsl:call-template>
  </audio>
</xsl:template>


<!--**==========================================================================
db2html.imagedata
Output an HTML #{img} element for a #{imagedata} element.
:Revision:version="3.10" date="2013-08-11" status="final"
$node: The #{imagedata} or other graphic element.

This template creates an #{img} element in the HTML output.  This template
is called not only for #{imagedata} elements, but also for #{graphic} and
#{inlinegraphic} elements.  Note that #{graphic} and #{inlinegraphic} are
deprecated and should not be used in any newly-written DocBook files.  Use
#{mediaobject} instead.

This template looks for a #{textobject} with a #{phrase} child in an ancestor
#{mediaobject} or #{inlinemediaobject} element. It uses the first available,
taking conditional processing into consideration.
-->
<xsl:template name="db2html.imagedata">
  <xsl:param name="node" select="."/>
  <img>
    <xsl:attribute name="src">
      <xsl:choose>
        <xsl:when test="$node/@fileref">
          <xsl:value-of select="$node/@fileref"/>
        </xsl:when>
        <xsl:when test="$node/@entityref">
          <xsl:value-of select="unparsed-entity-uri($node/@entityref)"/>
        </xsl:when>
      </xsl:choose>
    </xsl:attribute>
    <xsl:if test="$node/@contentwidth">
      <xsl:attribute name="width">
        <xsl:value-of select="$node/@contentwidth"/>
      </xsl:attribute>
    </xsl:if>
    <xsl:if test="$node/@contentdepth">
      <xsl:attribute name="height">
        <xsl:value-of select="$node/@contentdepth"/>
      </xsl:attribute>
    </xsl:if>
    <xsl:variable name="media" select="(self::imagedata/ancestor::mediaobject[1] |
                                        self::imagedata/ancestor::inlinemediaobject[1] |
                                        self::db:imagedata/ancestor::db:mediaobject[1] |
                                        self::db:imagedata/ancestor::db:inlinemediaobject[1]
                                       )[last()]"/>
    <xsl:variable name="alt" select="$media/textobject[phrase] | $media/db:textobject[db:phrase]"/>
    <xsl:variable name="altpos">
      <xsl:for-each select="$alt">
        <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
        <xsl:if test="$if != ''">
          <xsl:value-of select="concat(',', position())"/>
        </xsl:if>
      </xsl:for-each>
    </xsl:variable>
    <xsl:if test="$altpos != ''">
      <xsl:attribute name="alt">
        <xsl:variable name="obj" select="$alt[position() = number(str:split($altpos, ',')[1])]"/>
        <xsl:value-of select="$obj/phrase | $obj/db:phrase"/>
      </xsl:attribute>
    </xsl:if>
  </img>
</xsl:template>


<!--**==========================================================================
db2html.videodata
Output an HTML #{video} element for a #{videodata} element.
:Revision:version="3.8" date="2012-11-12" status="final"
$node: The #{videodata} element.

This template creates a #{video} element in the HTML output. If the containing
#{mediaobject} or #{inlinemediaobject} element has an #{imageobject} with the
#{role} attribute set to #{"poster"}, that image will be used for the #{poster}
attribute on the HTML #{video} element. This template calls
*{db2html.mediaobject.fallback} for the contents of the #{video} element.
-->
<xsl:template name="db2html.videodata">
  <xsl:param name="node" select="."/>
  <xsl:variable name="media" select="($node/ancestor::mediaobject[1] |
                                      $node/ancestor::inlinemediaobject[1] |
                                      $node/ancestor::db:mediaobject[1] |
                                      $node/ancestor::db:inlinemediaobject[1]
                                     )[last()]"/>
  <video preload="auto" controls="controls">
    <xsl:attribute name="src">
      <xsl:choose>
        <xsl:when test="$node/@fileref">
          <xsl:value-of select="$node/@fileref"/>
        </xsl:when>
        <xsl:when test="$node/@entityref">
          <xsl:value-of select="unparsed-entity-uri($node/@entityref)"/>
        </xsl:when>
      </xsl:choose>
    </xsl:attribute>
    <xsl:if test="$node/@contentwidth">
      <xsl:attribute name="width">
        <xsl:value-of select="$node/@contentwidth"/>
      </xsl:attribute>
    </xsl:if>
    <xsl:if test="$node/@contentdepth">
      <xsl:attribute name="height">
        <xsl:value-of select="$node/@contentdepth"/>
      </xsl:attribute>
    </xsl:if>
    <xsl:variable name="poster"
                  select="$media/imageobject[@role = 'poster']/imagedata |
                          $media/db:imageobject[@role = 'poster']/db:imagedata"/>
    <xsl:if test="$poster">
      <xsl:attribute name="poster">
        <xsl:choose>
          <xsl:when test="$poster/@fileref">
            <xsl:value-of select="$poster/@fileref"/>
          </xsl:when>
          <xsl:when test="$poster/@entityref">
            <xsl:value-of select="unparsed-entity-uri($poster/@entityref)"/>
          </xsl:when>
        </xsl:choose>
      </xsl:attribute>
    </xsl:if>
    <xsl:attribute name="data-play-label">
      <xsl:call-template name="l10n.gettext">
        <xsl:with-param name="msgid" select="'Play'"/>
      </xsl:call-template>
    </xsl:attribute>
    <xsl:attribute name="data-pause-label">
      <xsl:call-template name="l10n.gettext">
        <xsl:with-param name="msgid" select="'Pause'"/>
      </xsl:call-template>
    </xsl:attribute>
    <xsl:call-template name="db2html.mediaobject.fallback">
      <xsl:with-param name="node" select="$media"/>
    </xsl:call-template>
  </video>
</xsl:template>


<!--**==========================================================================
db2html.mediaobject
Outputs HTML for a #{mediaobject} element.
:Revision:version="3.10" date="2013-08-11" status="final"
$node: The #{mediaobject} element.

This template processes a #{mediaobject} element and outputs the appropriate
HTML. DocBook allows multiple objects to be listed in a #{mediaobject} element.
Processing tools are expected to choose the earliest suitable object. This
template will select the first audio, image, or video object it can handle,
filtering out images in non-web formats, and taking conditional processing
into consideration. If no suitable non-text objects are found, this template
calls *{db2html.mediaobject.fallback}.

This template also detects MathML embedded in a DocBook 5 #{imagedata} element
with the #{format} attribute #{"mathml"}, and passes it to the templates in
!{db2html-math}.
-->
<xsl:template name="db2html.mediaobject">
  <xsl:param name="node" select="."/>
  <xsl:variable name="objs" select="
    $node/audioobject | $node/db:audioobject |
    $node/videoobject | $node/db:videoobject |
    $node/imageobject[imagedata[
      @format = 'GIF'  or @format = 'GIF87a' or @format = 'GIF89a' or
      @format = 'JPEG' or @format = 'JPG'    or @format = 'PNG'    or
      not(@format)]] |
    $node/imageobjectco[imageobject/imagedata[
      @format = 'GIF'  or @format = 'GIF87a' or @format = 'GIF89a' or
      @format = 'JPEG' or @format = 'JPG'    or @format = 'PNG'    or
      not(@format)]] |
    $node/db:imageobject[db:imagedata[
      @format = 'GIF'  or @format = 'GIF87a' or @format = 'GIF89a' or
      @format = 'JPEG' or @format = 'JPG'    or @format = 'PNG'    or
      not(@format)]] |
    $node/db:imageobject[db:imagedata[@format = 'mathml'][mml:math]] |
    $node/db:imageobjectco[db:imageobject/db:imagedata[
      @format = 'GIF'  or @format = 'GIF87a' or @format = 'GIF89a' or
      @format = 'JPEG' or @format = 'JPG'    or @format = 'PNG'    or
      not(@format)]] "/>
  <xsl:variable name="objspos">
    <xsl:for-each select="$objs">
      <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
      <xsl:if test="$if != ''">
        <xsl:value-of select="concat(',', position())"/>
      </xsl:if>
    </xsl:for-each>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="$objspos != ''">
      <xsl:apply-templates select="$objs[position() = number(str:split($objspos, ',')[1])]"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:call-template name="db2html.mediaobject.fallback">
        <xsl:with-param name="node" select="$node"/>
      </xsl:call-template>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>


<!--**==========================================================================
db2html.mediaobject.fallback
Outputs fallback HTML for a #{mediaobject} element.
:Revision:version="3.10" date="2013-08-11" status="final"
$node: The #{mediaobject} element.

This template outputs HTML for the first suitable #{textobject} child element
of ${node}. If ${node} is an #{inlinemediaobject}, it looks for a #{textobject}
that contains a #{phrase} element. Otherwise, it looks for a #{textobject} with
normal block content. It also handles conditional processing on the #{textobject}
elements.
-->
<xsl:template name="db2html.mediaobject.fallback">
  <xsl:param name="node" select="."/>
  <xsl:choose>
    <xsl:when test="local-name($node) = 'inlinemediaobject'">
      <xsl:variable name="alt" select="$node/textobject[phrase] | $node/db:textobject[db:phrase]"/>
      <xsl:variable name="altpos">
        <xsl:for-each select="$alt">
          <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
          <xsl:if test="$if != ''">
            <xsl:value-of select="concat(',', position())"/>
          </xsl:if>
        </xsl:for-each>
      </xsl:variable>
      <xsl:if test="$altpos != ''">
        <xsl:variable name="obj" select="$alt[position() = number(str:split($altpos, ',')[1])]"/>
        <xsl:apply-templates select="$obj/phrase | $obj/db:phrase"/>
      </xsl:if>
    </xsl:when>
    <xsl:otherwise>
      <xsl:variable name="alt" select="$node/textobject[not(phrase or textdata)] |
                                       $node/db:textobject[not(db:phrase or db:textdata)]"/>
      <xsl:variable name="altpos">
        <xsl:for-each select="$alt">
          <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
          <xsl:if test="$if != ''">
            <xsl:value-of select="concat(',', position())"/>
          </xsl:if>
        </xsl:for-each>
      </xsl:variable>
      <xsl:if test="$altpos != ''">
        <xsl:apply-templates select="$alt[position() = number(str:split($altpos, ',')[1])]/*"/>
      </xsl:if>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>


<!-- == Matched Templates == -->

<!-- = audiodata = -->
<xsl:template match="mediaobject/audioobject/audiodata |
                     db:mediaobject/db:audioobject/db:audiodata">
  <div>
    <xsl:call-template name="html.class.attr">
      <xsl:with-param name="class" select="'media media-audio'"/>
    </xsl:call-template>
    <div class="inner">
      <xsl:call-template name="db2html.audiodata">
        <xsl:with-param name="inline" select="false()"/>
      </xsl:call-template>
    </div>
  </div>
</xsl:template>
<xsl:template match="inlinemediaobject/audioobject/audiodata |
                     db:inlinemediaobject/db:audioobject/db:audiodata">
  <span>
    <xsl:call-template name="html.class.attr">
      <xsl:with-param name="class" select="'media media-audio'"/>
    </xsl:call-template>
    <xsl:call-template name="db2html.audiodata"/>
  </span>
</xsl:template>

<!-- = audioobject = -->
<xsl:template match="audioobject | db:audioobject">
  <xsl:apply-templates select="audiodata | db:audiodata"/>
</xsl:template>

<!-- = graphic = -->
<xsl:template match="graphic">
  <div>
    <xsl:call-template name="html.class.attr">
      <xsl:with-param name="class" select="'graphic'"/>
    </xsl:call-template>
    <xsl:call-template name="db2html.anchor"/>
    <xsl:call-template name="db2html.imagedata"/>
  </div>
</xsl:template>

<!-- = imagedata = -->
<xsl:template match="imagedata | db:imagedata">
  <xsl:choose>
    <xsl:when test="@format = 'mathml' and mml:math">
      <xsl:apply-templates select="mml:math"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:call-template name="db2html.imagedata"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<!-- = imageobject = -->
<xsl:template match="imageobject | db:imageobject">
  <xsl:apply-templates select="imagedata | db:imagedata"/>
</xsl:template>

<!-- = inlinegraphic = -->
<xsl:template match="inlinegraphic">
  <span>
    <xsl:call-template name="html.class.attr">
      <xsl:with-param name="class" select="'inlinegraphic'"/>
    </xsl:call-template>
    <xsl:call-template name="db2html.anchor"/>
    <xsl:call-template name="db2html.imagedata"/>
  </span>
</xsl:template>

<!-- = inlinemediaobject = -->
<xsl:template match="inlinemediaobject | db:inlinemediaobject">
  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
  <xsl:if test="$if != ''">
  <span>
    <xsl:call-template name="html.class.attr">
      <xsl:with-param name="class" select="'inlinemediaobject'"/>
    </xsl:call-template>
    <xsl:call-template name="db2html.anchor"/>
    <xsl:call-template name="db2html.mediaobject"/>
  </span>
  </xsl:if>
</xsl:template>

<!-- = mediaojbect = -->
<xsl:template match="mediaobject | db:mediaobject">
  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
  <xsl:if test="$if != ''">
  <div>
    <xsl:call-template name="html.class.attr">
      <xsl:with-param name="class" select="'mediaobject'"/>
    </xsl:call-template>
    <xsl:call-template name="db2html.anchor"/>
    <xsl:call-template name="db2html.mediaobject"/>
    <!-- When a figure contains only a single mediaobject, it eats the caption -->
    <xsl:if test="not(../self::figure or ../self::informalfigure or
                      ../self::db:figure or ../self::db:informalfigure) or
                  ../*[not(self::blockinfo) and not(self::title) and
                       not(self::db:info) and not(self::db:title) and
                       not(self::titleabbrev) and not(self::db:titleabbrev) and
                       not(. = current()) ]">
      <xsl:apply-templates select="caption | db:caption"/>
    </xsl:if>
  </div>
  </xsl:if>
</xsl:template>

<!-- = videodata = -->
<xsl:template match="mediaobject/videoobject/videodata |
                     db:mediaobject/db:videoobject/db:videodata">
  <div>
    <xsl:call-template name="html.class.attr">
      <xsl:with-param name="class" select="'media media-video'"/>
    </xsl:call-template>
    <div class="inner">
      <xsl:call-template name="db2html.videodata">
        <xsl:with-param name="inline" select="false()"/>
      </xsl:call-template>
    </div>
  </div>
</xsl:template>
<xsl:template match="inlinemediaobject/videoobject/videodata |
                     db:inlinemediaobject/db:videoobject/db:videodata">
  <span>
    <xsl:call-template name="html.class.attr">
      <xsl:with-param name="class" select="'media media-video'"/>
    </xsl:call-template>
    <xsl:call-template name="db2html.videodata"/>
  </span>
</xsl:template>

<!-- = videoobject = -->
<xsl:template match="videoobject | db:videoobject">
  <xsl:apply-templates select="videodata | db:videodata"/>
</xsl:template>

</xsl:stylesheet>