root/docs/docbook-xsl/manpages/refentry.xsl

Revision 23dea7e00df87480acb58bb3398283c2bb227949, 6.2 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 7 years ago)

pull docs into master

  • Property mode set to 100644
Line 
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                 version='1.0'>
4
5 <!-- ********************************************************************
6      $Id: refentry.xsl,v 1.9 2005/07/05 00:15:52 xmldoc Exp $
7      ********************************************************************
8
9      This file is part of the XSL DocBook Stylesheet distribution.
10      See ../README or http://docbook.sf.net/release/xsl/current/ for
11      copyright and other information.
12
13      ******************************************************************** -->
14
15 <!-- ==================================================================== -->
16
17   <xsl:template match="refnamediv">
18     <xsl:choose>
19       <xsl:when test="preceding-sibling::refnamediv">
20         <!-- * no title on secondary refnamedivs! -->
21       </xsl:when>
22       <xsl:otherwise>
23         <xsl:call-template name="mark.subheading"/>
24         <xsl:text>.SH "</xsl:text>
25         <xsl:apply-templates select="." mode="title.markup"/>
26         <xsl:text>"</xsl:text>
27       </xsl:otherwise>
28     </xsl:choose>
29     <xsl:text>&#10;</xsl:text>
30     <xsl:call-template name="mark.subheading"/>
31     <!-- * if we have multiple Refname instances, separate the names -->
32     <!-- * with commas -->
33     <xsl:for-each select="refname">
34       <xsl:if test="position()>1">
35         <xsl:text>, </xsl:text>
36       </xsl:if>
37       <xsl:value-of select="."/>
38     </xsl:for-each>
39     <!-- * The man(7) man pages says: -->
40     <!-- * -->
41     <!-- *   The only required heading is NAME, which should be the -->
42     <!-- *   first section and be followed on the next line by a one -->
43     <!-- *   line description of the program: -->
44     <!-- * -->
45     <!-- *      .SH NAME chess \- the game of chess -->
46     <!-- * -->
47     <!-- *   It is extremely important that this format is followed, -->
48     <!-- *   and that there is a backslash before the single dash -->
49     <!-- *   which follows the command name.  This syntax is used by -->
50     <!-- *   the makewhatis(8) program to create a database of short -->
51     <!-- *   command descriptions for the whatis(1) and apropos(1) -->
52     <!-- *   commands. -->
53     <!-- * -->
54     <!-- * So why don't we precede the hyphen with a backslash here? -->
55     <!-- * Well, because it's added later, by the apply-string-subst-map -->
56     <!-- * template, before we generate final output -->
57     <xsl:text> - </xsl:text>
58     <xsl:value-of select="normalize-space (refpurpose)"/>
59     <xsl:text>&#10;</xsl:text>
60   </xsl:template>
61
62   <xsl:template match="refsynopsisdiv">
63     <xsl:call-template name="mark.subheading"/>
64     <xsl:text>.SH "</xsl:text>
65     <xsl:apply-templates select="." mode="title.markup"/>
66     <xsl:text>"&#10;</xsl:text>
67     <xsl:call-template name="mark.subheading"/>
68     <xsl:apply-templates/>
69   </xsl:template>
70
71   <xsl:template match="refsect1|refentry/refsection">
72     <xsl:call-template name="mark.subheading"/>
73     <xsl:text>.SH "</xsl:text>
74     <xsl:apply-templates select="." mode="title.markup"/>
75     <xsl:text>"&#10;</xsl:text>
76     <xsl:call-template name="mark.subheading"/>
77     <xsl:apply-templates/>
78   </xsl:template>
79
80   <xsl:template match="refsect2|refentry/refsection/refsection">
81     <xsl:call-template name="mark.subheading"/>
82     <xsl:text>.SS "</xsl:text>
83     <xsl:value-of select="(info/title
84                           |refsectioninfo/title
85                           |refsect1info/title
86                           |title)[1]"/>
87     <xsl:text>"&#10;</xsl:text>
88     <xsl:call-template name="mark.subheading"/>
89     <xsl:apply-templates/>
90   </xsl:template>
91
92   <xsl:template match="refsect3|refsection">
93     <xsl:call-template name="nested-section-title"/>
94     <xsl:text>.RS 3&#10;</xsl:text>
95     <xsl:apply-templates/>
96     <xsl:text>.RE&#10;</xsl:text>
97   </xsl:template>
98
99   <!-- ==================================================================== -->
100
101   <!-- * Use uppercase to render titles of all instances of Refsect1 or -->
102   <!-- * top-level Refsection, including in cross-references -->
103   <xsl:template match="refsect1|refentry/refsection"
104                 mode="title.markup">
105     <xsl:variable name="title" select="(info/title
106                                        |refsectioninfo/title
107                                        |refsect1info/title
108                                        |title)[1]"/>
109     <xsl:call-template name="string.upper">
110       <xsl:with-param name="string">
111         <xsl:apply-templates select="$title" mode="title.markup"/>
112       </xsl:with-param>
113     </xsl:call-template>
114   </xsl:template>
115
116   <!-- * Use uppercase to render titles of all instances of Refsynopsisdiv, -->
117   <!-- * including in cross-references -->
118   <xsl:template match="refsynopsisdiv" mode="title.markup">
119     <xsl:param name="allow-anchors" select="0"/>
120     <xsl:call-template name="string.upper">
121       <xsl:with-param name="string">
122         <xsl:choose>
123           <xsl:when test="info/title
124                           |refsynopsisdivinfo/title
125                           |title">
126             <xsl:apply-templates
127                 select="(info/title
128                         |refsynopsisdivinfo/title
129                         |title)[1]" mode="title.markup">
130               <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
131             </xsl:apply-templates>
132           </xsl:when>
133           <xsl:otherwise>
134             <xsl:call-template name="gentext">
135               <xsl:with-param name="key" select="'RefSynopsisDiv'"/>
136             </xsl:call-template>
137           </xsl:otherwise>
138         </xsl:choose>
139       </xsl:with-param>
140     </xsl:call-template>
141   </xsl:template>
142
143   <!-- * Use uppercase to render titles of all instances of Refnamediv, -->
144   <!-- * including in cross-references -->
145   <xsl:template match="refnamediv" mode="title.markup">
146     <xsl:call-template name="string.upper">
147       <xsl:with-param name="string">
148         <xsl:call-template name="gentext">
149           <xsl:with-param name="key" select="'RefName'"/>
150         </xsl:call-template>
151       </xsl:with-param>
152     </xsl:call-template>
153   </xsl:template>
154
155   <xsl:template match="refnamediv" mode="xref-to">
156     <xsl:apply-templates select="." mode="title.markup"/>
157   </xsl:template>
158
159   <!-- ==================================================================== -->
160
161   <!-- * suppress any title we don't otherwise process elsewhere -->
162
163   <xsl:template match="title"/>
164
165 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.