This file is indexed.

/usr/share/yelp-xsl/xslt/mallard/common/mal-if.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
<?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:mal="http://projectmallard.org/1.0/"
                xmlns:if="http://projectmallard.org/if/1.0/"
                xmlns:str="http://exslt.org/strings"
                exclude-result-prefixes="mal if str"
                version="1.0">

<!--!!==========================================================================
Mallard Conditionals
Support for run-time conditional processing.
:Revision:version="3.8" date="2012-11-05" status="final"

This stylesheet contains utilities for handling conditional processing
in Mallard documents.
-->


<!--@@==========================================================================
mal.if.target
The list of supported target tokens.
:Revision:version="3.8" date="2012-11-05" status="final"

This parameter takes a space-separated list of tokens to enable for conditional
processing. It is used by the template *{mal.if.test}. This parameter is meant
to hold tokens starting with #{target:}. It should usually be set by the primary
importing stylesheet.
-->
<xsl:param name="mal.if.target" select="''"/>


<!--@@==========================================================================
mal.if.platform
The list of supported platform tokens.
:Revision:version="3.8" date="2012-11-05" status="final"

This parameter takes a space-separated list of tokens to enable for conditional
processing. It is used by the template *{mal.if.test}. This parameter is meant
to hold tokens starting with #{platform:}. It should usually be set by hand or
by a customization stylesheet.
-->
<xsl:param name="mal.if.platform" select="''"/>


<!--@@==========================================================================
mal.if.features
The list of supported feature tokens.
:Revision:version="3.8" date="2012-11-05" status="final"

This parameter takes a space-separated list of tokens to enable for conditional
processing. It is used by the template *{mal.if.test}. This parameter is meant
to hold tokens that specify the capabilities of these stylesheets. It should
usually be set by the primary importing stylesheet.
-->
<xsl:param name="mal.if.features" select="'
mallard:1.0
'"/>


<!--@@==========================================================================
mal.if.custom
A custom list of supported tokens.
:Revision:version="3.8" date="2012-11-05" status="final"

This parameter takes a space-separated list of tokens to enable for conditional
processing. It is used by the template *{mal.if.test}. This parameter is meant
to hold extra values enabled by hand or by a customization stylesheet.
-->
<xsl:param name="mal.if.custom" select="''"/>


<!--@@==========================================================================
mal.if.maybe
A list of tokens that may be true.
:Revision:version="3.8" date="2012-11-05" status="final"

This parameter takes a space-separated list of tokens that may be true. The
template *{mal.if.test} returns special flags when a condition may be true,
allowing conditional processing to be deferred (for example, to CSS media
selectors). This parameter should usually be set by the primary importing
stylesheet.
-->
<xsl:param name="mal.if.maybe" select="''"/>


<xsl:variable name="_mal.if.tokens" select="concat(' ', $mal.if.target,
                                                   ' ', $mal.if.platform,
                                                   ' ', $mal.if.features,
                                                   ' ', $mal.if.custom,
                                                   ' ')"/>
<xsl:variable name="_mal.if.maybe" select="concat(' ', $mal.if.maybe, ' ')"/>


<!--**==========================================================================
mal.if.test
Test if a condition is true.
:Revision:version="3.8" date="2012-11-05" status="final"
$node: The element to check the condition for.
$test: The test expression.

This template evaluates the test expression ${test}, which is taken automatically
from the #{test} or #{if:test} attribute of $node. It splits the expression on
commas into subexpression, then splits each subexpression on spaces into tokens.
A token is taken to be true if it's in one of the space-separated lists from
@{mal.if.target}, @{mal.if.platform}, @{mal.if.features}, or @{mal.if.custom}.
If the token starts with an exclamation point, the exclamation point is stripped
and the resulting truth value is negated.

A subexpression is true if all its tokens is true. The full test expression is
true if any subexpression is true. If the test expression is true, the literal
string #{'true'} is returned. If the test expression is false, the empty
string is returned.

This template can handle "maybe" values: tokens that may or may not be true,
and whose truth values are deferred to post-transform time. A token is maybe
if it appears in the space-separated list @{mal.if.maybe}. If a subexpression
contains a maybe value and does not contain any false tokens, its truth value
is a special string constructed from the maybe tokens and starting with the
string #{if__}. If any subexpressions are maybe and none of the subexpressions
are false, the return value is a space-separated list of the maybe strings.

Maybe tokens usually must be handled specifically by the importing stylesheet.
It's usually not sufficient to just add a token to @{mal.if.maybe}. This
template will handle any maybe token, but it does not handle the actual logic
of dynamically showing or hiding content based on those tokens.
-->
<xsl:template name="mal.if.test">
  <xsl:param name="node" select="."/>
  <xsl:param name="test" select="($node/self::if:if/@test |
                                  $node/self::if:when/@test |
                                  $node/@if:test)[1]"/>
  <xsl:choose>
    <xsl:when test="$test != ''">
      <xsl:variable name="ret">
        <xsl:for-each select="str:split($test, ',')">
          <xsl:text> </xsl:text>
          <xsl:variable name="subexpr">
            <xsl:for-each select="str:tokenize(., ' ')">
              <xsl:text> </xsl:text>
              <xsl:choose>
                <xsl:when test="starts-with(., '!')">
                  <xsl:variable name="tmp">
                    <xsl:call-template name="_mal.if.test.check_token">
                      <xsl:with-param name="node" select="$node"/>
                      <xsl:with-param name="token" select="substring(., 2)"/>
                    </xsl:call-template>
                  </xsl:variable>
                  <xsl:choose>
                    <xsl:when test="$tmp = '1'">
                      <xsl:text>0</xsl:text>
                    </xsl:when>
                    <xsl:when test="$tmp = '0'">
                      <xsl:text>1</xsl:text>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="concat('not-', $tmp)"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:call-template name="_mal.if.test.check_token">
                    <xsl:with-param name="node" select="$node"/>
                    <xsl:with-param name="token" select="."/>
                  </xsl:call-template>
                </xsl:otherwise>
              </xsl:choose>
              <xsl:text> </xsl:text>
            </xsl:for-each>
          </xsl:variable>
          <xsl:choose>
            <xsl:when test="contains($subexpr, ' 0 ')">
              <xsl:text></xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:variable name="subcond">
                <xsl:for-each select="str:tokenize($subexpr, ' ')[.!='1']">
                  <xsl:if test="position != 1">
                    <xsl:text>__</xsl:text>
                  </xsl:if>
                  <xsl:value-of select="."/>
                </xsl:for-each>
              </xsl:variable>
              <xsl:choose>
                <xsl:when test="$subcond != ''">
                  <xsl:text>if__</xsl:text>
                  <xsl:value-of select="$subcond"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>true</xsl:text>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
        <xsl:text> </xsl:text>
      </xsl:variable>
      <xsl:choose>
        <xsl:when test="contains($ret, ' true ')">
          <xsl:text>true</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:for-each select="str:split($ret, ' ')[. != 'true']">
            <xsl:value-of select="."/>
            <xsl:text> </xsl:text>
          </xsl:for-each>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <xsl:text>true</xsl:text>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<!--#* _mal.if.test.check_token -->
<xsl:template name="_mal.if.test.check_token">
  <xsl:param name="node"/>
  <xsl:param name="token"/>
  <xsl:choose>
    <xsl:when test="$token = 'lang:C' or $token = 'lang:c'">
      <xsl:choose>
        <xsl:when test="not(ancestor-or-self::*/@xml:lang)">
          <xsl:text>1</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text>0</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
    <xsl:when test="starts-with($token, 'lang:')">
      <xsl:for-each select="$node">
        <xsl:choose>
          <xsl:when test="lang(substring($token, 6))">
            <xsl:text>1</xsl:text>
          </xsl:when>
          <xsl:otherwise>
            <xsl:text>0</xsl:text>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
    </xsl:when>
    <xsl:when test="contains($_mal.if.tokens, concat(' ', $token, ' '))">
      <xsl:text>1</xsl:text>
    </xsl:when>
    <xsl:when test="contains($_mal.if.maybe, concat(' ', $token, ' '))">
      <xsl:call-template name="_mal.if.test.flatten_token">
        <xsl:with-param name="token" select="$token"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:text>0</xsl:text>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<!--#* _mal.if.test.flatten_token -->
<xsl:template name="_mal.if.test.flatten_token">
  <xsl:param name="token"/>
  <xsl:for-each select="str:split($token, '')">
    <xsl:choose>
      <xsl:when test="contains('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', .)">
        <xsl:value-of select="."/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>-</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>