~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/erl_docgen/priv/xsl/db_man.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?xml version="1.0" encoding="utf-8"?>
2
 
<!--      
 
2
<!--
3
3
     #
4
4
     # %CopyrightBegin%
5
 
     # 
6
 
     # Copyright Ericsson AB 2009. All Rights Reserved.
7
 
     # 
 
5
     #
 
6
     # Copyright Ericsson AB 2009-2010. All Rights Reserved.
 
7
     #
8
8
     # The contents of this file are subject to the Erlang Public License,
9
9
     # Version 1.1, (the "License"); you may not use this file except in
10
10
     # compliance with the License. You should have received a copy of the
11
11
     # Erlang Public License along with this software. If not, it can be
12
12
     # retrieved online at http://www.erlang.org/.
13
 
     # 
 
13
     #
14
14
     # Software distributed under the License is distributed on an "AS IS"
15
15
     # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16
16
     # the License for the specific language governing rights and limitations
17
17
     # under the License.
18
 
     # 
 
18
     #
19
19
     # %CopyrightEnd%
20
 
     
 
20
 
21
21
     -->
22
22
 
23
23
<xsl:stylesheet version="1.0"
24
 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
 
24
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
25
25
 
26
26
  <xsl:preserve-space elements="code pre"/>
27
27
  <xsl:strip-space elements="*"/>
28
28
  <xsl:output method="text" encoding="UTF-8" indent="no"/>
29
29
 
 
30
  <!-- Start of Dialyzer type/spec tags. See also the template matching "name"
 
31
  -->
 
32
 
 
33
  <!-- Note: specs data for *one* module (as opposed to html and pdf) -->
 
34
  <xsl:param name="specs_file" select="''"/>
 
35
  <xsl:variable name="i" select="document($specs_file)"></xsl:variable>
 
36
 
 
37
  <xsl:template name="err">
 
38
    <xsl:param name="m"/>
 
39
    <xsl:param name="n"/>
 
40
    <xsl:param name="a"/>
 
41
    <xsl:param name="s"/>
 
42
    <xsl:message terminate="yes">
 
43
  Error <xsl:if test="$m != ''"><xsl:value-of select ="$m"/>:</xsl:if>
 
44
         <xsl:value-of
 
45
                   select="$n"/>/<xsl:value-of
 
46
                   select="$a"/>: <xsl:value-of select="$s"/>
 
47
    </xsl:message>
 
48
  </xsl:template>
 
49
 
 
50
  <xsl:template name="spec_name">
 
51
    <xsl:variable name="curModule" select="ancestor::erlref/module"/>
 
52
    <xsl:variable name="mod" select="@mod"/>
 
53
    <xsl:variable name="name" select="@name"/>
 
54
    <xsl:variable name="arity" select="@arity"/>
 
55
    <xsl:variable name="clause" select="@clause"/>
 
56
    <xsl:variable name="spec0" select=
 
57
        "$i/module[@name=$curModule]/spec
 
58
             [name=$name and arity=$arity
 
59
              and (string-length($mod) = 0 or module = $mod)]"/>
 
60
    <xsl:variable name="spec" select="$spec0[string-length($clause) = 0
 
61
                                             or position() = $clause]"/>
 
62
    <xsl:if test="count($spec) = 0">
 
63
      <xsl:call-template name="err">
 
64
        <xsl:with-param name="m" select="$mod"/>
 
65
        <xsl:with-param name="n" select="$name"/>
 
66
        <xsl:with-param name="a" select="$arity"/>
 
67
        <xsl:with-param name="s">unknown spec</xsl:with-param>
 
68
      </xsl:call-template>
 
69
    </xsl:if>
 
70
 
 
71
    <xsl:choose>
 
72
      <xsl:when test="ancestor::cref">
 
73
        <xsl:message terminate="yes">
 
74
          Error: did not expect a 'name' tag with name/arity attributes here!
 
75
        </xsl:message>
 
76
      </xsl:when>
 
77
      <xsl:when test="ancestor::erlref">
 
78
        <xsl:choose>
 
79
          <xsl:when test="string(@with_guards) = 'no'">
 
80
             <xsl:apply-templates select="$spec/contract/clause/head"/>
 
81
          </xsl:when>
 
82
          <xsl:otherwise>
 
83
            <xsl:call-template name="contract">
 
84
              <xsl:with-param name="contract" select="$spec/contract"/>
 
85
            </xsl:call-template>
 
86
          </xsl:otherwise>
 
87
        </xsl:choose>
 
88
        <xsl:text>&#10;.br</xsl:text>
 
89
      </xsl:when>
 
90
    </xsl:choose>
 
91
  </xsl:template>
 
92
 
 
93
  <xsl:template name="contract">
 
94
    <xsl:param name="contract"/>
 
95
    <xsl:call-template name="clause">
 
96
      <xsl:with-param name="clause" select="$contract/clause"/>
 
97
    </xsl:call-template>
 
98
  </xsl:template>
 
99
 
 
100
  <xsl:template name="clause">
 
101
    <xsl:param name="clause"/>
 
102
    <xsl:variable name="type_desc" select="../type_desc"/>
 
103
    <xsl:for-each select="$clause">
 
104
      <xsl:apply-templates select="head"/>
 
105
      <xsl:if test="count(guard) > 0">
 
106
        <xsl:call-template name="guard">
 
107
          <xsl:with-param name="guard" select="guard"/>
 
108
          <xsl:with-param name="type_desc" select="$type_desc"/>
 
109
        </xsl:call-template>
 
110
      </xsl:if>
 
111
    </xsl:for-each>
 
112
  </xsl:template>
 
113
 
 
114
  <xsl:template match="head">
 
115
    <xsl:text>&#10;.nf&#10;</xsl:text>
 
116
    <xsl:text>&#10;.B&#10;</xsl:text>
 
117
    <xsl:apply-templates/>
 
118
    <xsl:text>&#10;.br</xsl:text>
 
119
    <xsl:text>&#10;.fi</xsl:text>
 
120
  </xsl:template>
 
121
 
 
122
  <xsl:template name="guard">
 
123
    <xsl:param name="guard"/>
 
124
    <xsl:param name="type_desc"/>
 
125
    <xsl:text>&#10;.RS</xsl:text>
 
126
    <xsl:text>&#10;.TP</xsl:text>
 
127
    <xsl:text>&#10;Types</xsl:text>
 
128
    <xsl:call-template name="subtype">
 
129
      <xsl:with-param name="subtype" select="$guard/subtype"/>
 
130
      <xsl:with-param name="type_desc" select="$type_desc"/>
 
131
    </xsl:call-template>
 
132
    <xsl:text>&#10;.RE</xsl:text>
 
133
  </xsl:template>
 
134
 
 
135
  <xsl:template name="subtype">
 
136
    <xsl:param name="subtype"/>
 
137
    <xsl:param name="type_desc"/>
 
138
    <xsl:for-each select="$subtype">
 
139
      <xsl:variable name="tname" select="typename"/>
 
140
      <xsl:variable name="tdesc" select="$type_desc[@name = $tname]"/>
 
141
        <xsl:text>&#10;</xsl:text>
 
142
        <xsl:apply-templates select="string"/>
 
143
        <xsl:text>&#10;.br</xsl:text>
 
144
      <xsl:apply-templates select="$type_desc[@name = $tname]"/>
 
145
    </xsl:for-each>
 
146
  </xsl:template>
 
147
 
 
148
  <!-- Note: <type_desc> has not been implemented for data types. -->
 
149
 
 
150
  <!-- Similar to <d> -->
 
151
  <xsl:template match="type_desc">
 
152
    <xsl:text>&#10;</xsl:text><xsl:apply-templates/>
 
153
    <xsl:text>&#10;.br</xsl:text>
 
154
  </xsl:template>
 
155
 
 
156
  <!-- Datatypes -->
 
157
  <xsl:template match="datatypes">
 
158
    <xsl:text>&#10;.SH DATA TYPES</xsl:text>
 
159
    <xsl:apply-templates/>
 
160
  </xsl:template>
 
161
 
 
162
  <!-- Datatype -->
 
163
  <xsl:template match="datatype">
 
164
    <xsl:apply-templates/>
 
165
  </xsl:template>
 
166
 
 
167
  <xsl:template match="typehead">
 
168
    <xsl:text>&#10;.nf&#10;</xsl:text>
 
169
    <xsl:text>&#10;.B&#10;</xsl:text>
 
170
    <xsl:apply-templates/>
 
171
    <xsl:text>&#10;.br</xsl:text>
 
172
    <xsl:text>&#10;.fi</xsl:text>
 
173
  </xsl:template>
 
174
 
 
175
  <xsl:template match="local_defs">
 
176
    <xsl:text>&#10;.RS</xsl:text>
 
177
    <xsl:apply-templates/>
 
178
    <xsl:text>&#10;.RE</xsl:text>
 
179
  </xsl:template>
 
180
 
 
181
  <xsl:template match="local_def">
 
182
    <xsl:text>&#10;</xsl:text>
 
183
    <xsl:apply-templates/>
 
184
    <xsl:text>&#10;.br</xsl:text>
 
185
  </xsl:template>
 
186
 
 
187
  <xsl:template name="type_name">
 
188
    <xsl:variable name="curModule" select="ancestor::erlref/module"/>
 
189
    <xsl:variable name="mod" select="@mod"/>
 
190
    <xsl:variable name="name" select="@name"/>
 
191
    <xsl:variable name="n_vars">
 
192
      <xsl:choose>
 
193
        <xsl:when test="string-length(@n_vars) > 0">
 
194
          <xsl:value-of select="@n_vars"/>
 
195
        </xsl:when>
 
196
        <xsl:otherwise>
 
197
          <xsl:value-of select="0"/>
 
198
        </xsl:otherwise>
 
199
      </xsl:choose>
 
200
    </xsl:variable>
 
201
 
 
202
    <xsl:choose>
 
203
      <xsl:when test="string-length($name) > 0">
 
204
        <xsl:variable name="type" select=
 
205
            "$i/module[@name=$curModule]/type
 
206
                 [name=$name and n_vars=$n_vars
 
207
                  and (string-length($mod) = 0 or module = $mod)]"/>
 
208
 
 
209
        <xsl:if test="count($type) != 1">
 
210
          <xsl:call-template name="err">
 
211
            <xsl:with-param name="m" select="$mod"/>
 
212
            <xsl:with-param name="n" select="$name"/>
 
213
            <xsl:with-param name="a" select="$n_vars"/>
 
214
            <xsl:with-param name="s">unknown type</xsl:with-param>
 
215
          </xsl:call-template>
 
216
        </xsl:if>
 
217
        <xsl:apply-templates select="$type/typedecl"/>
 
218
      </xsl:when>
 
219
      <xsl:otherwise>
 
220
        <xsl:text>&#10;.nf&#10;</xsl:text>
 
221
        <xsl:text>&#10;.B&#10;</xsl:text>
 
222
        <xsl:apply-templates/>
 
223
        <xsl:text>&#10;.br</xsl:text>
 
224
        <xsl:text>&#10;.fi</xsl:text>
 
225
      </xsl:otherwise>
 
226
    </xsl:choose>
 
227
  </xsl:template>
 
228
 
 
229
  <!-- Used both in <datatype> and in <func>! -->
 
230
  <xsl:template match="anno">
 
231
    <xsl:variable name="curModule" select="ancestor::erlref/module"/>
 
232
    <xsl:variable name="anno" select="normalize-space(text())"/>
 
233
    <xsl:variable name="namespec"
 
234
                  select="ancestor::desc/preceding-sibling::name"/>
 
235
    <xsl:if test="count($namespec) = 0 and string-length($specs_file) > 0">
 
236
      <xsl:call-template name="err">
 
237
        <xsl:with-param name="s">cannot find 'name' (<xsl:value-of select="$anno"/>)
 
238
        </xsl:with-param>
 
239
      </xsl:call-template>
 
240
    </xsl:if>
 
241
 
 
242
    <xsl:variable name="mod" select="$namespec/@mod"/>
 
243
    <xsl:variable name="name" select="$namespec/@name"/>
 
244
    <xsl:variable name="arity" select="$namespec/@arity"/>
 
245
    <xsl:variable name="clause" select="$namespec/@clause"/>
 
246
    <xsl:variable name="tmp_n_vars" select="$namespec/@n_vars"/>
 
247
    <xsl:variable name="n_vars">
 
248
      <xsl:choose>
 
249
        <xsl:when test="string-length($tmp_n_vars) > 0">
 
250
          <xsl:value-of select="$tmp_n_vars"/>
 
251
        </xsl:when>
 
252
        <xsl:otherwise>
 
253
          <xsl:value-of select="0"/>
 
254
        </xsl:otherwise>
 
255
      </xsl:choose>
 
256
    </xsl:variable>
 
257
    <xsl:variable name="spec0" select=
 
258
        "$i/module[@name=$curModule]/spec
 
259
             [name=$name and arity=$arity
 
260
              and (string-length($mod) = 0 or module = $mod)]"/>
 
261
    <xsl:variable name="spec_annos" select=
 
262
         "$spec0[string-length($clause) = 0
 
263
                 or position() = $clause]/anno[.=$anno]"/>
 
264
    <xsl:variable name="type_annos" select=
 
265
        "$i/module[@name=$curModule]/type
 
266
             [name=$name and n_vars=$n_vars
 
267
              and (string-length($mod) = 0 or module = $mod)]/anno[.=$anno]"/>
 
268
 
 
269
    <xsl:if test="count($spec_annos) = 0
 
270
                  and count($type_annos) = 0
 
271
                  and string-length($specs_file) > 0">
 
272
      <xsl:variable name="n">
 
273
        <xsl:choose>
 
274
          <xsl:when test="string-length($arity) = 0">
 
275
            <xsl:value-of select="$n_vars"/>
 
276
          </xsl:when>
 
277
          <xsl:otherwise>
 
278
            <xsl:value-of select="$arity"/>
 
279
          </xsl:otherwise>
 
280
        </xsl:choose>
 
281
      </xsl:variable>
 
282
      <xsl:call-template name="err">
 
283
        <xsl:with-param name="m" select="$mod"/>
 
284
        <xsl:with-param name="n" select="$name"/>
 
285
        <xsl:with-param name="a" select="$n"/>
 
286
        <xsl:with-param name="s">unknown annotation <xsl:value-of select="$anno"/>
 
287
        </xsl:with-param>
 
288
      </xsl:call-template>
 
289
    </xsl:if>
 
290
    <xsl:value-of select="$anno"/>
 
291
  </xsl:template>
 
292
 
 
293
  <!-- Used for indentation of formatted types and specs -->
 
294
  <xsl:template match="nbsp">
 
295
    <xsl:text> </xsl:text>
 
296
  </xsl:template>
 
297
 
 
298
  <!-- End of Dialyzer type/spec tags -->
 
299
 
30
300
  <!-- Header -->
31
301
  <xsl:template match="header">
32
302
  </xsl:template>
33
 
  
 
303
 
34
304
  <!-- Section/Title -->
35
305
  <xsl:template match="section/title">
36
306
  </xsl:template>
37
 
  
 
307
 
38
308
  <!-- *ref/Section -->
39
309
  <xsl:template match="erlref/section|comref/section|cref/section|fileref/section|appref/section">
40
 
    <xsl:text>&#10;.RE&#10;</xsl:text>
41
310
    <xsl:text>&#10;.SH "</xsl:text><xsl:value-of select="translate(title, 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/><xsl:text>"&#10;</xsl:text>
42
311
    <xsl:apply-templates/>
43
312
  </xsl:template>
44
313
 
45
314
  <!-- *ref/Subsection -->
46
 
  <xsl:template match="erlref/section/section|comref/section/section|cref/section/section|fileref/section/section|appref/section/section">
47
 
    <xsl:text>&#10;.RE&#10;</xsl:text>
 
315
  <xsl:template match="section/section">
48
316
    <xsl:text>&#10;.SS "</xsl:text><xsl:value-of select="title"/><xsl:text>"&#10;</xsl:text>
49
317
    <xsl:apply-templates/>
50
318
  </xsl:template>
51
319
 
52
320
 
53
321
  <!-- Lists -->
54
 
  
 
322
 
55
323
  <xsl:template match="list">
56
 
    <xsl:text>&#10;.RS 2&#10;</xsl:text>
 
324
    <xsl:text>&#10;.RS 2</xsl:text>
57
325
    <xsl:apply-templates/>
58
326
    <xsl:text>&#10;.RE&#10;</xsl:text>
59
327
  </xsl:template>
61
329
  <xsl:template match="list/item">
62
330
    <xsl:text>&#10;.TP 2&#10;</xsl:text>
63
331
    <xsl:text>*&#10;</xsl:text>
64
 
    <xsl:variable name="content">
65
 
      <xsl:apply-templates/>
66
 
    </xsl:variable>
67
 
    <xsl:value-of select="normalize-space($content)"/>
68
 
    <xsl:text>&#10;.br&#10;</xsl:text>
69
 
    <xsl:text>&#10;.br&#10;</xsl:text>    
 
332
    <xsl:apply-templates/>
 
333
    <xsl:text>&#10;.LP&#10;</xsl:text>
70
334
  </xsl:template>
71
335
 
72
336
  <xsl:template match="taglist">
73
 
    <xsl:text>&#10;.RS 2&#10;</xsl:text>
74
 
    <xsl:apply-templates/>
 
337
    <xsl:text>&#10;.RS 2</xsl:text>
 
338
    <xsl:apply-templates select="tag|item"/>
75
339
    <xsl:text>&#10;.RE&#10;</xsl:text>
76
340
  </xsl:template>
77
 
  
 
341
 
78
342
  <xsl:template match="taglist/tag">
79
 
    <xsl:text>&#10;.TP 4&#10;</xsl:text>
 
343
    <xsl:text>&#10;.TP 2&#10;</xsl:text>
80
344
    <xsl:text>.B&#10;</xsl:text>
 
345
    <xsl:apply-templates/><xsl:text>:&#10;</xsl:text>
 
346
  </xsl:template>
 
347
 
 
348
  <xsl:template match="taglist/item">
81
349
    <xsl:apply-templates/>
82
350
  </xsl:template>
83
351
 
85
353
    <xsl:variable name="content">
86
354
      <xsl:apply-templates/>
87
355
    </xsl:variable>
88
 
    <xsl:value-of select="normalize-space($content)"/>
89
 
    <xsl:text>&#10;.br&#10;</xsl:text>
90
 
    <xsl:text>&#10;.br&#10;</xsl:text>
91
 
  </xsl:template>
92
 
 
93
 
 
94
 
  <xsl:template match="taglist/item">
95
 
    <xsl:text>&#10;</xsl:text>
96
 
    <xsl:apply-templates/>
 
356
    <xsl:choose>
 
357
      <xsl:when test="position() = 1">
 
358
        <xsl:value-of select="$content"/>
 
359
      </xsl:when>
 
360
      <xsl:otherwise>
 
361
        <xsl:text>&#10;.RS 2</xsl:text>
 
362
        <xsl:text>&#10;.LP&#10;&#10;.LP&#10;</xsl:text>
 
363
        <xsl:value-of select="$content"/>
 
364
        <xsl:text>&#10;.RE</xsl:text>
 
365
      </xsl:otherwise>
 
366
    </xsl:choose>
97
367
  </xsl:template>
98
368
 
99
369
  <!-- Note -->
100
370
  <xsl:template match="note">
101
 
    <xsl:text>&#10;.TP 4&#10;.B&#10;Note:&#10;</xsl:text>
 
371
    <xsl:text>&#10;.SS Note:</xsl:text>
102
372
    <xsl:apply-templates/>
 
373
    <xsl:text>&#10;</xsl:text>
103
374
  </xsl:template>
104
375
 
105
376
  <!-- Warning -->
106
377
  <xsl:template match="warning">
107
 
    <xsl:text>&#10;.TP 4&#10;.B&#10;Warning:&#10;</xsl:text>
 
378
    <xsl:text>&#10;.SS Warning:</xsl:text>
108
379
    <xsl:apply-templates/>
109
 
  </xsl:template>
110
 
 
111
 
  <xsl:template match="warning/p|note/p">
112
 
    <xsl:variable name="content">
113
 
      <xsl:apply-templates/>
114
 
    </xsl:variable>
115
 
    <xsl:value-of select="normalize-space($content)"/>
116
 
    <xsl:text>&#10;.LP&#10;</xsl:text>
117
 
  </xsl:template>
118
 
 
 
380
    <xsl:text>&#10;</xsl:text>
 
381
  </xsl:template>
119
382
 
120
383
 <!-- Paragraph -->
121
384
  <xsl:template match="p">
122
385
    <xsl:text>&#10;.LP&#10;</xsl:text>
123
 
    <xsl:variable name="content">
124
 
      <xsl:apply-templates/>
125
 
    </xsl:variable>
126
 
    <xsl:value-of select="normalize-space($content)"/>
 
386
    <xsl:apply-templates/>
127
387
  </xsl:template>
128
388
 
129
389
  <!-- Inline elements -->
130
390
  <xsl:template match="b">
131
 
    <xsl:text> \fB</xsl:text>
 
391
    <xsl:text>\fB</xsl:text>
132
392
    <xsl:apply-templates/>
133
 
    <xsl:text>\fR\&amp;</xsl:text>
 
393
    <xsl:text>\fR\&amp; </xsl:text>
134
394
  </xsl:template>
135
395
 
136
396
  <xsl:template match="br">
138
398
  </xsl:template>
139
399
 
140
400
  <xsl:template match="c">
141
 
    <xsl:text> \fI</xsl:text><xsl:value-of select="text()"/><xsl:text>\fR\&amp;</xsl:text>
 
401
    <xsl:text>\fI</xsl:text><xsl:apply-templates/><xsl:text>\fR\&amp;</xsl:text>
142
402
  </xsl:template>
143
403
 
144
404
  <xsl:template match="em">
145
 
    <xsl:text> \fI</xsl:text><xsl:value-of select="text()"/><xsl:text>\fR\&amp;</xsl:text>
 
405
    <xsl:text>\fI</xsl:text> <xsl:apply-templates/><xsl:text>\fR\&amp;</xsl:text>
146
406
  </xsl:template>
147
407
 
148
408
  <xsl:template match="seealso">
149
 
    <xsl:text> \fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&amp;</xsl:text>
 
409
    <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR\&amp;</xsl:text>
150
410
  </xsl:template>
151
411
 
152
412
  <!-- Code -->
153
413
  <xsl:template match="code">
 
414
    <xsl:text>&#10;.LP&#10;</xsl:text>
154
415
    <xsl:text>&#10;.nf&#10;</xsl:text>
155
416
    <xsl:apply-templates/>
156
417
    <xsl:text>&#10;.fi&#10;</xsl:text>
158
419
 
159
420
  <!-- Pre -->
160
421
  <xsl:template match="pre">
 
422
    <xsl:text>&#10;.LP&#10;</xsl:text>
161
423
    <xsl:text>&#10;.nf&#10;</xsl:text>
162
424
    <xsl:apply-templates/>
163
425
    <xsl:text>&#10;.fi&#10;</xsl:text>
168
430
  <xsl:template match="table">
169
431
  </xsl:template>
170
432
 
171
 
  <!--xsl:template match="row">
172
 
      <xsl:apply-templates/>
173
 
  </xsl:template>
174
 
 
175
 
  <xsl:template match="cell">
176
 
      <xsl:apply-templates/>
177
 
  </xsl:template -->
178
 
 
179
 
 
180
 
  <!-- Image -->
 
433
 <!-- Image -->
181
434
  <xsl:template match="image">
182
435
  </xsl:template>
183
436
 
188
441
  <xsl:template match="application">
189
442
      <xsl:apply-templates/>
190
443
  </xsl:template>
191
 
  
 
444
 
192
445
  <!-- Erlref -->
193
446
  <xsl:template match="/erlref">
194
 
      <xsl:text>.TH </xsl:text><xsl:value-of select="module"/><xsl:text> 3 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "Erlang Module Definition"&#10;</xsl:text>
195
 
      <xsl:text>.SH MODULE&#10;</xsl:text>
196
 
      <xsl:value-of select="module"/><xsl:text> \- </xsl:text><xsl:value-of select="modulesummary"/><xsl:text>&#10;</xsl:text>  
197
 
      <xsl:apply-templates/>
 
447
    <xsl:variable name="companyname">
 
448
      <xsl:choose>
 
449
        <!-- Workaround until all of OTP's .../holder contents are correct.  -->
 
450
        <xsl:when test="starts-with(header/copyright/holder,'Ericsson AB')"><xsl:text>Ericsson AB</xsl:text></xsl:when>
 
451
        <xsl:otherwise><xsl:value-of select="header/copyright/holder"/></xsl:otherwise>
 
452
      </xsl:choose>
 
453
    </xsl:variable>
 
454
 
 
455
    <xsl:text>.TH </xsl:text><xsl:value-of select="module"/><xsl:text> 3 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "Erlang Module Definition"&#10;</xsl:text>
 
456
    <xsl:text>.SH NAME&#10;</xsl:text>
 
457
    <xsl:value-of select="module"/><xsl:text> \- </xsl:text><xsl:value-of select="modulesummary"/><xsl:text>&#10;</xsl:text>
 
458
    <xsl:apply-templates/>
198
459
  </xsl:template>
199
460
 
200
461
  <!-- Comref -->
201
462
  <xsl:template match="/comref">
202
 
      <xsl:text>.TH </xsl:text><xsl:value-of select="com"/><xsl:text> 1 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "User Commands"&#10;</xsl:text>
203
 
      <xsl:text>.SH NAME&#10;</xsl:text>
204
 
      <xsl:value-of select="com"/><xsl:text> \- </xsl:text><xsl:value-of select="comsummary"/><xsl:text>&#10;</xsl:text>  
205
 
      <xsl:apply-templates/>
 
463
    <xsl:variable name="companyname">
 
464
      <xsl:choose>
 
465
        <!-- Workaround until all of OTP's .../holder contents are correct.  -->
 
466
        <xsl:when test="starts-with(header/copyright/holder,'Ericsson AB')"><xsl:text>Ericsson AB</xsl:text></xsl:when>
 
467
        <xsl:otherwise><xsl:value-of select="header/copyright/holder"/></xsl:otherwise>
 
468
      </xsl:choose>
 
469
    </xsl:variable>
 
470
   <xsl:text>.TH </xsl:text><xsl:value-of select="com"/><xsl:text> 1 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "User Commands"&#10;</xsl:text>
 
471
    <xsl:text>.SH NAME&#10;</xsl:text>
 
472
    <xsl:value-of select="com"/><xsl:text> \- </xsl:text><xsl:value-of select="comsummary"/><xsl:text>&#10;</xsl:text>
 
473
    <xsl:apply-templates/>
206
474
  </xsl:template>
207
475
 
208
476
  <!-- Cref -->
209
477
  <xsl:template match="/cref">
210
 
      <xsl:text>.TH </xsl:text><xsl:value-of select="lib"/><xsl:text> 3 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "C Library Functions"&#10;</xsl:text>
211
 
      <xsl:text>.SH NAME&#10;</xsl:text>
212
 
      <xsl:value-of select="lib"/><xsl:text> \- </xsl:text><xsl:value-of select="libsummary"/><xsl:text>&#10;</xsl:text>  
213
 
      <xsl:apply-templates/>
 
478
    <xsl:variable name="companyname">
 
479
      <xsl:choose>
 
480
        <!-- Workaround until all of OTP's .../holder contents are correct.  -->
 
481
        <xsl:when test="starts-with(header/copyright/holder,'Ericsson AB')"><xsl:text>Ericsson AB</xsl:text></xsl:when>
 
482
        <xsl:otherwise><xsl:value-of select="header/copyright/holder"/></xsl:otherwise>
 
483
      </xsl:choose>
 
484
    </xsl:variable>
 
485
    <xsl:text>.TH </xsl:text><xsl:value-of select="lib"/><xsl:text> 3 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "C Library Functions"&#10;</xsl:text>
 
486
    <xsl:text>.SH NAME&#10;</xsl:text>
 
487
    <xsl:value-of select="lib"/><xsl:text> \- </xsl:text><xsl:value-of select="libsummary"/><xsl:text>&#10;</xsl:text>
 
488
    <xsl:apply-templates/>
214
489
  </xsl:template>
215
490
 
216
491
  <!-- Fileref -->
217
492
  <xsl:template match="/fileref">
218
 
      <xsl:text>.TH </xsl:text><xsl:value-of select="file"/><xsl:text> 4 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "Files"&#10;</xsl:text>
219
 
      <xsl:text>.SH NAME&#10;</xsl:text>
220
 
      <xsl:value-of select="file"/><xsl:text> \- </xsl:text><xsl:value-of select="filesummary"/><xsl:text>&#10;</xsl:text>  
221
 
      <xsl:apply-templates/>
 
493
    <xsl:variable name="companyname">
 
494
      <xsl:choose>
 
495
        <!-- Workaround until all of OTP's .../holder contents are correct.  -->
 
496
        <xsl:when test="starts-with(header/copyright/holder,'Ericsson AB')"><xsl:text>Ericsson AB</xsl:text></xsl:when>
 
497
        <xsl:otherwise><xsl:value-of select="header/copyright/holder"/></xsl:otherwise>
 
498
      </xsl:choose>
 
499
    </xsl:variable>
 
500
    <xsl:text>.TH </xsl:text><xsl:value-of select="file"/><xsl:text> 5 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "Files"&#10;</xsl:text>
 
501
    <xsl:text>.SH NAME&#10;</xsl:text>
 
502
    <xsl:value-of select="file"/><xsl:text> \- </xsl:text><xsl:value-of select="filesummary"/><xsl:text>&#10;</xsl:text>
 
503
    <xsl:apply-templates/>
222
504
  </xsl:template>
223
505
 
224
506
  <!-- Appref -->
225
507
  <xsl:template match="/appref">
226
 
      <xsl:text>.TH </xsl:text><xsl:value-of select="app"/><xsl:text> 6 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "Ericsson AB" "Erlang Application Definition"&#10;</xsl:text>
227
 
      <xsl:text>.SH NAME&#10;</xsl:text>
228
 
      <xsl:value-of select="file"/><xsl:text> \- </xsl:text><xsl:value-of select="filesummary"/><xsl:text>&#10;</xsl:text>  
229
 
      <xsl:apply-templates/>
 
508
    <xsl:variable name="companyname">
 
509
      <xsl:choose>
 
510
        <!-- Workaround until all of OTP's .../holder contents are correct.  -->
 
511
        <xsl:when test="starts-with(header/copyright/holder,'Ericsson AB')"><xsl:text>Ericsson AB</xsl:text></xsl:when>
 
512
        <xsl:otherwise><xsl:value-of select="header/copyright/holder"/></xsl:otherwise>
 
513
      </xsl:choose>
 
514
    </xsl:variable>
 
515
    <xsl:text>.TH </xsl:text><xsl:value-of select="app"/><xsl:text> 7 "</xsl:text><xsl:value-of select="$appname"/><xsl:text> </xsl:text><xsl:value-of select="$appver"/><xsl:text>" "</xsl:text><xsl:value-of select="$companyname"/><xsl:text>" "Erlang Application Definition"&#10;</xsl:text>
 
516
    <xsl:text>.SH NAME&#10;</xsl:text>
 
517
    <xsl:value-of select="app"/><xsl:text> \- </xsl:text><xsl:value-of select="appsummary"/><xsl:text>&#10;</xsl:text>
 
518
    <xsl:apply-templates/>
230
519
  </xsl:template>
231
520
 
232
521
  <!-- Module|Com|Lib|File|App-->
252
541
  <!-- Func -->
253
542
  <xsl:template match="func">
254
543
    <xsl:text>&#10;.LP</xsl:text>
255
 
    <xsl:apply-templates/>
 
544
    <xsl:apply-templates select="name"/>
 
545
    <xsl:apply-templates select="fsummary|type|desc"/>
256
546
  </xsl:template>
257
547
 
258
548
  <xsl:template match="name">
 
549
    <xsl:choose>
 
550
      <!-- @arity is mandatory when referring to a specification -->
 
551
      <xsl:when test="string-length(@arity) > 0">
 
552
        <xsl:call-template name="spec_name"/>
 
553
      </xsl:when>
 
554
      <xsl:when test="ancestor::datatype">
 
555
        <xsl:call-template name="type_name"/>
 
556
      </xsl:when>
 
557
      <xsl:otherwise>
 
558
        <xsl:call-template name="name"/>
 
559
      </xsl:otherwise>
 
560
    </xsl:choose>
 
561
  </xsl:template>
 
562
 
 
563
  <xsl:template name="name">
259
564
    <xsl:text>&#10;.B&#10;</xsl:text>
260
565
    <xsl:apply-templates/>
261
566
    <xsl:text>&#10;.br</xsl:text>
277
582
    <xsl:text>&#10;</xsl:text><xsl:value-of select="normalize-space(text())"/>
278
583
    <xsl:text>&#10;.br</xsl:text>
279
584
  </xsl:template>
280
 
  
 
585
 
281
586
  <!-- D -->
282
587
  <xsl:template match="d">
283
588
    <xsl:text>&#10;</xsl:text><xsl:apply-templates/>
297
602
    <!-- This tag is skipped for now. -->
298
603
  </xsl:template>
299
604
 
300
 
  <!-- xsl:template match="p/text()">
301
 
    <xsl:value-of select="normalize-space()"/>
302
 
  </xsl:template-->
303
 
 
304
 
  <xsl:template match="d/text()">
305
 
    <xsl:value-of select="normalize-space()"/>
 
605
 
 
606
  <!-- Authors -->
 
607
  <xsl:template match="authors">
 
608
    <xsl:text>&#10;.SH AUTHORS</xsl:text>
 
609
    <xsl:apply-templates/>
 
610
  </xsl:template>
 
611
 
 
612
  <!-- Aname -->
 
613
  <xsl:template match="authors/aname">
 
614
    <xsl:text>&#10;.LP&#10;</xsl:text>
 
615
    <xsl:apply-templates/>
 
616
  </xsl:template>
 
617
 
 
618
  <!-- Email -->
 
619
  <xsl:template match="authors/email">
 
620
    <xsl:text>&#10;.I&#10;&lt;</xsl:text>
 
621
    <xsl:apply-templates/>
 
622
    <xsl:text>&gt;</xsl:text>
 
623
  </xsl:template>
 
624
 
 
625
  <!-- Do not noramlize any text within pre and code tags. -->
 
626
  <xsl:template match="pre/text()">
 
627
      <xsl:call-template name="replace-string">
 
628
        <xsl:with-param name="text" select="." />
 
629
        <xsl:with-param name="replace" select="&quot;\&quot;" />
 
630
        <xsl:with-param name="with" select="&quot;\\&quot;" />
 
631
      </xsl:call-template>
 
632
  </xsl:template>
 
633
 
 
634
  <xsl:template match="code/text()">
 
635
      <xsl:call-template name="replace-string">
 
636
        <xsl:with-param name="text" select="." />
 
637
        <xsl:with-param name="replace" select="&quot;\&quot;" />
 
638
        <xsl:with-param name="with" select="&quot;\\&quot;" />
 
639
      </xsl:call-template>
 
640
  </xsl:template>
 
641
 
 
642
  <!-- Replace ' by \&' ans . by \&. -->
 
643
  <xsl:template match="text()">
 
644
    <xsl:variable name="startstring">
 
645
      <xsl:value-of select="normalize-space()"/><xsl:text> </xsl:text>
 
646
    </xsl:variable>
 
647
    <xsl:variable name="rep1">
 
648
      <xsl:call-template name="replace-string">
 
649
        <xsl:with-param name="text" select="$startstring" />
 
650
        <xsl:with-param name="replace" select="&quot;\&quot;" />
 
651
        <xsl:with-param name="with" select="&quot;\\&quot;" />
 
652
      </xsl:call-template>
 
653
    </xsl:variable>
 
654
    <xsl:variable name="rep2">
 
655
      <xsl:call-template name="replace-string">
 
656
        <xsl:with-param name="text" select="$rep1" />
 
657
        <xsl:with-param name="replace" select="&quot;&apos;&quot;" />
 
658
        <xsl:with-param name="with" select="&quot;\&amp;&apos;&quot;" />
 
659
      </xsl:call-template>
 
660
    </xsl:variable>
 
661
    <xsl:call-template name="replace-string">
 
662
      <xsl:with-param name="text" select="$rep2" />
 
663
      <xsl:with-param name="replace" select="&quot;.&quot;" />
 
664
      <xsl:with-param name="with" select="&quot;\&amp;.&quot;" />
 
665
    </xsl:call-template>
 
666
  </xsl:template>
 
667
 
 
668
  <!-- Template replace-string is borrowed at http://www.dpawson.co.uk/xsl/sect2/replace.html -->
 
669
  <xsl:template name="replace-string">
 
670
    <xsl:param name="text"/>
 
671
    <xsl:param name="replace"/>
 
672
    <xsl:param name="with"/>
 
673
    <xsl:choose>
 
674
      <xsl:when test="contains($text,$replace)">
 
675
        <xsl:value-of select="substring-before($text,$replace)"/>
 
676
        <xsl:value-of select="$with"/>
 
677
        <xsl:call-template name="replace-string">
 
678
          <xsl:with-param name="text" select="substring-after($text,$replace)"/>
 
679
          <xsl:with-param name="replace" select="$replace"/>
 
680
          <xsl:with-param name="with" select="$with"/>
 
681
        </xsl:call-template>
 
682
      </xsl:when>
 
683
      <xsl:otherwise>
 
684
        <xsl:value-of select="$text"/>
 
685
      </xsl:otherwise>
 
686
    </xsl:choose>
306
687
  </xsl:template>
307
688
 
308
689
</xsl:stylesheet>