1
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
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
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
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
19
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
20
xmlns:str="http://exslt.org/strings"
21
exclude-result-prefixes="str"
24
<!--!!==========================================================================
26
Support for DocBook effectivity attributes
27
:Revision:version="3.10" date="2013-08-12" status="final"
29
This stylesheet contains utilities for handling conditional processing
34
<!--@@==========================================================================
36
The list of architectures for conditional processing.
37
:Revision:version="3.10" date="2013-08-12" status="final"
39
This parameter takes a semicolon-separated list of values to match against the
40
#{arch} attribute for conditional processing.
42
<xsl:param name="db.profile.arch" select="''"/>
45
<!--@@==========================================================================
47
The list of audiences for conditional processing.
48
:Revision:version="3.10" date="2013-08-12" status="final"
50
This parameter takes a semicolon-separated list of values to match against the
51
#{audience} attribute for conditional processing.
53
<xsl:param name="db.profile.audience" select="''"/>
56
<!--@@==========================================================================
58
The list of application-specific conditions for conditional processing.
59
:Revision:version="3.10" date="2013-08-12" status="final"
61
This parameter takes a semicolon-separated list of values to match against the
62
#{condition} attribute for conditional processing.
64
<xsl:param name="db.profile.condition" select="''"/>
67
<!--@@==========================================================================
68
db.profile.conformance
69
The list of conformance characteristics for conditional processing.
70
:Revision:version="3.10" date="2013-08-12" status="final"
72
This parameter takes a semicolon-separated list of values to match against the
73
#{conformance} attribute for conditional processing.
75
<xsl:param name="db.profile.conformance" select="''"/>
78
<!--@@==========================================================================
80
The list of operating systems for conditional processing.
81
:Revision:version="3.10" date="2013-08-12" status="final"
83
This parameter takes a semicolon-separated list of values to match against the
84
#{os} attribute for conditional processing.
86
<xsl:param name="db.profile.os" select="''"/>
89
<!--@@==========================================================================
90
db.profile.outputformat
91
The list of output formats for conditional processing.
92
:Revision:version="3.10" date="2013-08-12" status="final"
94
This parameter takes a semicolon-separated list of values to match against the
95
#{outputformat} attribute for conditional processing.
97
<xsl:param name="db.profile.os" select="''"/>
100
<!--@@==========================================================================
102
The list of editorial revisions for conditional processing.
103
:Revision:version="3.10" date="2013-08-12" status="final"
105
This parameter takes a semicolon-separated list of values to match against the
106
#{revision} attribute for conditional processing.
108
<xsl:param name="db.profile.revision" select="''"/>
111
<!--@@==========================================================================
113
The list of security levels for conditional processing.
114
:Revision:version="3.10" date="2013-08-12" status="final"
116
This parameter takes a semicolon-separated list of values to match against the
117
#{security} attribute for conditional processing.
119
<xsl:param name="db.profile.security" select="''"/>
122
<!--@@==========================================================================
124
The list of user experience levels for conditional processing.
125
:Revision:version="3.10" date="2013-08-12" status="final"
127
This parameter takes a semicolon-separated list of values to match against the
128
#{userlevel} attribute for conditional processing.
130
<xsl:param name="db.profile.userlevel" select="''"/>
133
<!--@@==========================================================================
135
The list of vendors for conditional processing.
136
:Revision:version="3.10" date="2013-08-12" status="final"
138
This parameter takes a semicolon-separated list of values to match against the
139
#{vendor} attribute for conditional processing.
141
<xsl:param name="db.profile.vendor" select="''"/>
144
<!--@@==========================================================================
146
The list of word sizes for conditional processing.
147
:Revision:version="3.10" date="2013-08-12" status="final"
149
This parameter takes a semicolon-separated list of values to match against the
150
#{wordsize} attribute for conditional processing.
152
<xsl:param name="db.profile.wordsize" select="''"/>
155
<!--**==========================================================================
157
Test if an element should be shown based on profiling attributes.
158
:Revision:version="3.10" date="2013-08-12" status="final"
159
$node: The element to check the condition for.
161
This template looks at all the profiling attributes of the element ${node}:
162
#{arch}, #{audience}, #{condition}, #{conformance}, #{os}, #{outputformat},
163
#{revision}, #{security}, #{userlevel}, #{vendor}, and #{wordsize}. It returns
164
the string #{"true"} if all attributes present match the corresponding parameter
165
in this stylesheet. Attributes and parameters can both be lists, separated by
166
semicolons. An attribute matches a parameter if there is at least one value in
167
common between the two.
169
<xsl:template name="db.profile.test">
170
<xsl:param name="node" select="."/>
172
<xsl:variable name="testnot">
173
<xsl:if test="$node/@arch != '' and $db.profile.arch != ''">
174
<xsl:variable name="testarch">
175
<xsl:call-template name="_db.profile.test.compare">
176
<xsl:with-param name="attr" select="$node/@arch"/>
177
<xsl:with-param name="value" select="$db.profile.arch"/>
180
<xsl:if test="$testarch = ''">
181
<xsl:text>x</xsl:text>
185
<xsl:if test="$node/@audience != '' and $db.profile.audience != ''">
186
<xsl:variable name="testaudience">
187
<xsl:call-template name="_db.profile.test.compare">
188
<xsl:with-param name="attr" select="$node/@audience"/>
189
<xsl:with-param name="value" select="$db.profile.audience"/>
192
<xsl:if test="$testaudience = ''">
193
<xsl:text>x</xsl:text>
197
<xsl:if test="$node/@condition != '' and $db.profile.condition != ''">
198
<xsl:variable name="testcondition">
199
<xsl:call-template name="_db.profile.test.compare">
200
<xsl:with-param name="attr" select="$node/@condition"/>
201
<xsl:with-param name="value" select="$db.profile.condition"/>
204
<xsl:if test="$testcondition = ''">
205
<xsl:text>x</xsl:text>
209
<xsl:if test="$node/@conformance != '' and $db.profile.conformance != ''">
210
<xsl:variable name="testconformance">
211
<xsl:call-template name="_db.profile.test.compare">
212
<xsl:with-param name="attr" select="$node/@conformance"/>
213
<xsl:with-param name="value" select="$db.profile.conformance"/>
216
<xsl:if test="$testconformance = ''">
217
<xsl:text>x</xsl:text>
221
<xsl:if test="$node/@os != '' and $db.profile.os != ''">
222
<xsl:variable name="testos">
223
<xsl:call-template name="_db.profile.test.compare">
224
<xsl:with-param name="attr" select="$node/@os"/>
225
<xsl:with-param name="value" select="$db.profile.os"/>
228
<xsl:if test="$testos = ''">
229
<xsl:text>x</xsl:text>
233
<xsl:if test="$node/@outputformat != '' and $db.profile.outputformat != ''">
234
<xsl:variable name="testoutputformat">
235
<xsl:call-template name="_db.profile.test.compare">
236
<xsl:with-param name="attr" select="$node/@outputformat"/>
237
<xsl:with-param name="value" select="$db.profile.outputformat"/>
240
<xsl:if test="$testoutputformat = ''">
241
<xsl:text>x</xsl:text>
245
<xsl:if test="$node/@revision != '' and $db.profile.revision != ''">
246
<xsl:variable name="testrevision">
247
<xsl:call-template name="_db.profile.test.compare">
248
<xsl:with-param name="attr" select="$node/@revision"/>
249
<xsl:with-param name="value" select="$db.profile.revision"/>
252
<xsl:if test="$testrevision = ''">
253
<xsl:text>x</xsl:text>
257
<xsl:if test="$node/@security != '' and $db.profile.security != ''">
258
<xsl:variable name="testsecurity">
259
<xsl:call-template name="_db.profile.test.compare">
260
<xsl:with-param name="attr" select="$node/@security"/>
261
<xsl:with-param name="value" select="$db.profile.security"/>
264
<xsl:if test="$testsecurity = ''">
265
<xsl:text>x</xsl:text>
269
<xsl:if test="$node/@userlevel != '' and $db.profile.userlevel != ''">
270
<xsl:variable name="testuserlevel">
271
<xsl:call-template name="_db.profile.test.compare">
272
<xsl:with-param name="attr" select="$node/@userlevel"/>
273
<xsl:with-param name="value" select="$db.profile.userlevel"/>
276
<xsl:if test="$testuserlevel = ''">
277
<xsl:text>x</xsl:text>
281
<xsl:if test="$node/@vendor != '' and $db.profile.vendor != ''">
282
<xsl:variable name="testvendor">
283
<xsl:call-template name="_db.profile.test.compare">
284
<xsl:with-param name="attr" select="$node/@vendor"/>
285
<xsl:with-param name="value" select="$db.profile.vendor"/>
288
<xsl:if test="$testvendor = ''">
289
<xsl:text>x</xsl:text>
293
<xsl:if test="$node/@wordsize != '' and $db.profile.wordsize != ''">
294
<xsl:variable name="testwordsize">
295
<xsl:call-template name="_db.profile.test.compare">
296
<xsl:with-param name="attr" select="$node/@wordsize"/>
297
<xsl:with-param name="value" select="$db.profile.wordsize"/>
300
<xsl:if test="$testwordsize = ''">
301
<xsl:text>x</xsl:text>
306
<xsl:if test="$testnot = ''">
307
<xsl:text>true</xsl:text>
311
<!--#* _db.profile.test.compare -->
312
<xsl:template name="_db.profile.test.compare">
313
<xsl:param name="attr"/>
314
<xsl:param name="value"/>
315
<xsl:variable name="attr_" select="concat(';', $attr, ';')"/>
316
<xsl:for-each select="str:split($value, ';')">
317
<xsl:if test="contains($attr_, concat(';', ., ';'))">
318
<xsl:text>1</xsl:text>