s3: Fix bug #9085.
[Samba.git] / docs-xml / xslt / man.xsl
blobe259004330c98a0aa5521855875f7a7fbf16023d
1 <?xml version='1.0'?>
2 <!-- vim:set sts=2 shiftwidth=2 syntax=xml: -->
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:xlink='http://www.w3.org/1999/xlink'
5 version='1.0'>
7 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/>
9 <xsl:param name="chunk.section.depth" select="0"/>
10 <xsl:param name="chunk.first.sections" select="1"/>
11 <xsl:param name="use.id.as.filename" select="1"/>
12 <xsl:param name="man.endnotes.are.numbered" select="0"/>
14 <!--
15 Our ulink stylesheet omits @url part if content was specified
16 -->
17 <xsl:template match="ulink">
18 <xsl:variable name="content">
19 <xsl:apply-templates/>
20 </xsl:variable>
21 <xsl:if test="$content = ''">
22 <xsl:text>: </xsl:text>
23 </xsl:if>
24 <xsl:if test="$content != ''">
25 <xsl:value-of select="$content" />
26 </xsl:if>
27 <xsl:if test="$content = ''">
28 <xsl:apply-templates mode="italic" select="@url" />
29 </xsl:if>
30 </xsl:template>
32 <xsl:template match="itemizedlist/listitem">
33 <!-- * We output a real bullet here (rather than, "\(bu", -->
34 <!-- * the roff bullet) because, when we do character-map -->
35 <!-- * processing before final output, the character-map will -->
36 <!-- * handle conversion of the &#x2022; to "\(bu" for us -->
37 <xsl:text>&#10;</xsl:text>
38 <xsl:text>.sp</xsl:text>
39 <xsl:text>&#10;</xsl:text>
40 <xsl:text>.RS</xsl:text>
41 <xsl:if test="not($list-indent = '')">
42 <xsl:text> </xsl:text>
43 <xsl:value-of select="$list-indent"/>
44 </xsl:if>
45 <xsl:text>&#10;</xsl:text>
46 <!-- * if "n" then we are using "nroff", which means the output is for -->
47 <!-- * TTY; so we do some fixed-width-font hackery with \h to make a -->
48 <!-- * hanging indent (instead of using .IP, which has some -->
49 <!-- * undesirable side effects under certain circumstances) -->
50 <xsl:call-template name="roff-if-else-start"/>
51 <xsl:text>\h'-</xsl:text>
52 <xsl:choose>
53 <xsl:when test="not($list-indent = '')">
54 <xsl:text>0</xsl:text>
55 <xsl:value-of select="$list-indent"/>
56 </xsl:when>
57 <xsl:otherwise>
58 <xsl:text>\n(INu</xsl:text>
59 </xsl:otherwise>
60 </xsl:choose>
61 <xsl:text>'</xsl:text>
62 <xsl:text>&#x2022;</xsl:text>
63 <xsl:text>\h'+</xsl:text>
64 <xsl:choose>
65 <xsl:when test="not($list-indent = '')">
66 <xsl:text>0</xsl:text>
67 <xsl:value-of select="$list-indent - 1"/>
68 </xsl:when>
69 <xsl:otherwise>
70 <xsl:text>\n(INu-1</xsl:text>
71 </xsl:otherwise>
72 </xsl:choose>
73 <xsl:text>'\c&#10;</xsl:text>
74 <!-- * else, we are not using for "nroff", but instead "troff" - which -->
75 <!-- * means not for TTY, but for PS or whatever; so we’re not using a -->
76 <!-- * fixed-width font, so use a real .IP instead -->
77 <xsl:call-template name="roff-else"/>
78 <!-- * .IP generates a blank like of space, so let’s go backwards one -->
79 <!-- * line up to compensate for that -->
80 <xsl:text>.sp -1&#10;</xsl:text>
81 <xsl:text>.IP \(bu 2.3&#10;</xsl:text>
82 <!-- * The value 2.3 is the amount of indentation; we use 2.3 instead -->
83 <!-- * of 2 because when the font family is New Century Schoolbook it -->
84 <!-- * seems to require the extra space. -->
85 <xsl:call-template name="roff-if-end"/>
86 <xsl:apply-templates/>
87 <xsl:if test=" following-sibling::listitem">
88 <xsl:text>&#10;.RE&#10;</xsl:text>
89 </xsl:if>
90 </xsl:template>
92 <xsl:template match="itemizedlist|orderedlist|procedure">
93 <xsl:if test="title">
94 <xsl:text>.PP&#10;</xsl:text>
95 <xsl:call-template name="bold">
96 <xsl:with-param name="node" select="title"/>
97 <xsl:with-param name="context" select="."/>
98 </xsl:call-template>
99 <xsl:text>&#10;</xsl:text>
100 </xsl:if>
101 <!-- * DocBook allows just about any block content to appear in -->
102 <!-- * lists before the actual list items, so we need to get that -->
103 <!-- * content (if any) before getting the list items -->
104 <xsl:apply-templates
105 select="*[not(self::listitem) and not(self::title)]"/>
106 <xsl:apply-templates select="listitem"/>
107 <xsl:if test="(parent::para or parent::listitem) or following-sibling::node()">
108 <xsl:text>.sp&#10;</xsl:text>
109 <xsl:text>.RE&#10;</xsl:text>
110 </xsl:if>
111 </xsl:template>
113 <xsl:template match="refsect3">
114 <xsl:text>&#10;.SS "</xsl:text>
115 <xsl:value-of select="title[1]"/>
116 <xsl:text>"&#10;</xsl:text>
117 <xsl:apply-templates/>
118 </xsl:template>
120 <!-- ================================================================== -->
121 <!-- These macros are from Docbook manpages XSLT development tree -->
122 <!-- help to maintain manpage generation clean when difference between -->
123 <!-- roff processors is important to note. -->
125 <xsl:template name="roff-if-else-start">
126 <xsl:param name="condition">n</xsl:param>
127 <xsl:text>.ie </xsl:text>
128 <xsl:value-of select="$condition"/>
129 <xsl:text> \{\&#10;</xsl:text>
130 </xsl:template>
132 <xsl:template name="roff-if-start">
133 <xsl:param name="condition">n</xsl:param>
134 <xsl:text>.if </xsl:text>
135 <xsl:value-of select="$condition"/>
136 <xsl:text> \{\&#10;</xsl:text>
137 </xsl:template>
139 <xsl:template name="roff-else">
140 <xsl:text>.\}&#10;</xsl:text>
141 <xsl:text>.el \{\&#10;</xsl:text>
142 </xsl:template>
144 <xsl:template name="roff-if-end">
145 <xsl:text>.\}&#10;</xsl:text>
146 </xsl:template>
148 </xsl:stylesheet>