/
custom.xsl
87 lines (72 loc) · 2.58 KB
/
custom.xsl
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
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!--
Customization xsl stylesheet for docbook to chunked html transform
@author Gaetano Giunta
@copyright (c) 2007-2015 G. Giunta
@license
@todo make the xsl more dynamic: the path to import chunk.xsl could be f.e. rewritten/injected by the php user
-->
<!-- import base stylesheet -->
<xsl:import href="../../../tools/docbook-xsl/xhtml/chunk.xsl"/>
<!-- customization vars -->
<xsl:param name="draft.mode">no</xsl:param>
<xsl:param name="funcsynopsis.style">ansi</xsl:param>
<xsl:param name="html.stylesheet">xmlrpc.css</xsl:param>
<xsl:param name="id.warnings">0</xsl:param>
<!-- elements added / modified -->
<!-- space between function name and opening parenthesis -->
<xsl:template match="funcdef" mode="ansi-nontabular">
<code>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:apply-templates mode="ansi-nontabular"/>
<xsl:text> ( </xsl:text>
</code>
</xsl:template>
<!-- space between return type and function name -->
<xsl:template match="funcdef/type" mode="ansi-nontabular">
<xsl:apply-templates mode="ansi-nontabular"/>
<xsl:text> </xsl:text>
</xsl:template>
<!-- space between last param and closing parenthesis, remove tailing semicolon -->
<xsl:template match="void" mode="ansi-nontabular">
<code>void )</code>
</xsl:template>
<xsl:template match="varargs" mode="ansi-nontabular">
<xsl:text>...</xsl:text>
<code> )</code>
</xsl:template>
<xsl:template match="paramdef" mode="ansi-nontabular">
<xsl:apply-templates mode="ansi-nontabular"/>
<xsl:choose>
<xsl:when test="following-sibling::*">
<xsl:text>, </xsl:text>
</xsl:when>
<xsl:otherwise>
<code> )</code>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- param types get code formatted (leave a space after type, as it is supposed to be before param name) -->
<xsl:template match="paramdef/type" mode="ansi-nontabular">
<xsl:choose>
<xsl:when test="$funcsynopsis.decoration != 0">
<code>
<xsl:apply-templates mode="ansi-nontabular"/>
</code>
</xsl:when>
<xsl:otherwise>
<code>
<xsl:apply-templates mode="ansi-nontabular"/>
</code>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
</xsl:template>
<!-- default values for function parameters -->
<xsl:template match="paramdef/initializer" mode="ansi-nontabular">
<xsl:text> = </xsl:text>
<xsl:apply-templates mode="ansi-nontabular"/>
</xsl:template>
</xsl:stylesheet>