Merge branch 'master' of ctdb into 'master' of samba
[samba.git] / docs-xml / xslt / man.xsl
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'>
6
7 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/>
8
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"/>
13
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>
31
32 <xsl:template match="itemizedlist|orderedlist|procedure">
33   <xsl:if test="title">
34     <xsl:text>.PP&#10;</xsl:text>
35     <xsl:call-template name="bold">
36       <xsl:with-param name="node" select="title"/>
37       <xsl:with-param name="context" select="."/>
38     </xsl:call-template>
39     <xsl:text>&#10;</xsl:text>
40   </xsl:if>
41   <!-- * DocBook allows just about any block content to appear in -->
42   <!-- * lists before the actual list items, so we need to get that -->
43   <!-- * content (if any) before getting the list items -->
44   <xsl:apply-templates
45     select="*[not(self::listitem) and not(self::title)]"/>
46   <xsl:apply-templates select="listitem"/>
47   <xsl:if test="(parent::para or parent::listitem) or following-sibling::node()">
48     <xsl:text>.sp&#10;</xsl:text>
49     <xsl:text>.RE&#10;</xsl:text>
50   </xsl:if>
51 </xsl:template>
52
53 <xsl:template match="refsect3">
54   <xsl:text>&#10;.SS "</xsl:text>
55   <xsl:value-of select="title[1]"/>
56   <xsl:text>"&#10;</xsl:text>
57   <xsl:apply-templates/>
58 </xsl:template>
59
60   <!-- ================================================================== -->
61   <!-- These macros are from Docbook manpages XSLT development tree       -->
62   <!-- help to maintain manpage generation clean when difference between  -->
63   <!-- roff processors is important to note.                              -->
64
65   <xsl:template name="roff-if-else-start">
66     <xsl:param name="condition">n</xsl:param>
67     <xsl:text>.ie </xsl:text>
68     <xsl:value-of select="$condition"/>
69     <xsl:text> \{\&#10;</xsl:text>
70   </xsl:template>
71
72   <xsl:template name="roff-if-start">
73     <xsl:param name="condition">n</xsl:param>
74     <xsl:text>.if </xsl:text>
75     <xsl:value-of select="$condition"/>
76     <xsl:text> \{\&#10;</xsl:text>
77   </xsl:template>
78
79   <xsl:template name="roff-else">
80     <xsl:text>.\}&#10;</xsl:text>
81     <xsl:text>.el \{\&#10;</xsl:text>
82   </xsl:template>
83
84   <xsl:template name="roff-if-end">
85     <xsl:text>.\}&#10;</xsl:text>
86   </xsl:template>
87
88 </xsl:stylesheet>