1 | <?xml version='1.0'?>
|
---|
2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
3 | xmlns:exsl="http://exslt.org/common"
|
---|
4 | exclude-result-prefixes="exsl"
|
---|
5 | version='1.0'>
|
---|
6 |
|
---|
7 | <xsl:import href="../html/docbook.xsl"/>
|
---|
8 |
|
---|
9 | <xsl:output method="text"
|
---|
10 | encoding="UTF-8"
|
---|
11 | indent="no"/>
|
---|
12 |
|
---|
13 | <!-- ********************************************************************
|
---|
14 | $Id: docbook.xsl,v 1.45 2005/07/11 10:29:58 xmldoc Exp $
|
---|
15 | ********************************************************************
|
---|
16 |
|
---|
17 | This file is part of the XSL DocBook Stylesheet distribution.
|
---|
18 | See ../README or http://docbook.sf.net/release/xsl/current/ for
|
---|
19 | copyright and other information.
|
---|
20 |
|
---|
21 | ******************************************************************** -->
|
---|
22 |
|
---|
23 | <!-- ==================================================================== -->
|
---|
24 |
|
---|
25 | <xsl:include href="../common/refentry.xsl"/>
|
---|
26 | <xsl:include href="param.xsl"/>
|
---|
27 | <xsl:include href="utility.xsl"/>
|
---|
28 | <xsl:include href="info.xsl"/>
|
---|
29 | <xsl:include href="other.xsl"/>
|
---|
30 | <xsl:include href="refentry.xsl"/>
|
---|
31 | <xsl:include href="block.xsl"/>
|
---|
32 | <xsl:include href="inline.xsl"/>
|
---|
33 | <xsl:include href="synop.xsl"/>
|
---|
34 | <xsl:include href="lists.xsl"/>
|
---|
35 | <xsl:include href="links.xsl"/>
|
---|
36 |
|
---|
37 | <!-- ==================================================================== -->
|
---|
38 |
|
---|
39 | <!-- * if document does not contain at least one refentry, then emit a -->
|
---|
40 | <!-- * message and stop -->
|
---|
41 | <xsl:template match="/">
|
---|
42 | <xsl:choose>
|
---|
43 | <xsl:when test="//refentry">
|
---|
44 | <xsl:apply-templates select="//refentry"/>
|
---|
45 | </xsl:when>
|
---|
46 | <xsl:otherwise>
|
---|
47 | <xsl:message>No refentry elements!</xsl:message>
|
---|
48 | </xsl:otherwise>
|
---|
49 | </xsl:choose>
|
---|
50 | </xsl:template>
|
---|
51 |
|
---|
52 | <!-- ============================================================== -->
|
---|
53 |
|
---|
54 | <xsl:template match="refentry">
|
---|
55 |
|
---|
56 | <!-- * Just use the first refname found as the "name" of the man -->
|
---|
57 | <!-- * page (which may different from the "title"...) -->
|
---|
58 | <xsl:variable name="first.refname" select="refnamediv[1]/refname[1]"/>
|
---|
59 |
|
---|
60 | <!-- * Because there are several times when we need to check *info of -->
|
---|
61 | <!-- * each refentry and *info of its parent, we get those and store -->
|
---|
62 | <!-- * as node-sets in memory. -->
|
---|
63 |
|
---|
64 | <!-- * Make a node-set with contents of *info -->
|
---|
65 | <xsl:variable name="get.info" select="(info|refentryinfo|docinfo)[1]"/>
|
---|
66 | <xsl:variable name="info" select="exsl:node-set($get.info)"/>
|
---|
67 | <!-- * Make a node-set with contents of parent's *info -->
|
---|
68 | <xsl:variable name="get.parentinfo"
|
---|
69 | select="(../info
|
---|
70 | |../referenceinfo
|
---|
71 | |../articleinfo
|
---|
72 | |../sectioninfo
|
---|
73 | |../appendixinfo
|
---|
74 | |../chapterinfo
|
---|
75 | |../sect1info
|
---|
76 | |../sect2info
|
---|
77 | |../sect3info
|
---|
78 | |../sect4info
|
---|
79 | |../sect5info
|
---|
80 | |../partinfo
|
---|
81 | |../prefaceinfo
|
---|
82 | |../docinfo)[1]"/>
|
---|
83 | <xsl:variable name="parentinfo" select="exsl:node-set($get.parentinfo)"/>
|
---|
84 |
|
---|
85 | <!-- * The get.refentry.metadata template is in -->
|
---|
86 | <!-- * ../common/refentry.xsl. It looks for metadata in $info -->
|
---|
87 | <!-- * and/or $parentinfo and in various other places and -->
|
---|
88 | <!-- * then puts it into a form that's easier for us to digest. -->
|
---|
89 | <xsl:variable name="get.refentry.metadata">
|
---|
90 | <xsl:call-template name="get.refentry.metadata">
|
---|
91 | <xsl:with-param name="refname" select="$first.refname"/>
|
---|
92 | <xsl:with-param name="info" select="$info"/>
|
---|
93 | <xsl:with-param name="parentinfo" select="$parentinfo"/>
|
---|
94 | <xsl:with-param name="prefs" select="$refentry.metadata.prefs"/>
|
---|
95 | </xsl:call-template>
|
---|
96 | </xsl:variable>
|
---|
97 | <xsl:variable name="refentry.metadata" select="exsl:node-set($get.refentry.metadata)"/>
|
---|
98 |
|
---|
99 | <!-- * Assemble the various parts into a complete page, then store into -->
|
---|
100 | <!-- * $manpage.contents so that we can manipluate them further. -->
|
---|
101 | <xsl:variable name="manpage.contents">
|
---|
102 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
103 | <!-- * top.comment = commented-out section at top of roff source -->
|
---|
104 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
105 | <xsl:call-template name="top.comment"/>
|
---|
106 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
107 | <!-- * TH.title.line = title line in header/footer of man page -->
|
---|
108 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
109 | <xsl:call-template name="TH.title.line">
|
---|
110 | <!-- * .TH TITLE section extra1 extra2 extra3 -->
|
---|
111 | <!-- * -->
|
---|
112 | <!-- * According to the man(7) man page: -->
|
---|
113 | <!-- * -->
|
---|
114 | <!-- * extra1 = date, "the date of the last revision" -->
|
---|
115 | <!-- * extra2 = source, "the source of the command" -->
|
---|
116 | <!-- * extra3 = manual, "the title of the manual -->
|
---|
117 | <!-- * (e.g., Linux Programmer's Manual)" -->
|
---|
118 | <!-- * -->
|
---|
119 | <!-- * So, we end up with: -->
|
---|
120 | <!-- * -->
|
---|
121 | <!-- * .TH TITLE section date source manual -->
|
---|
122 | <!-- * -->
|
---|
123 | <xsl:with-param name="title" select="$refentry.metadata/title"/>
|
---|
124 | <xsl:with-param name="section" select="$refentry.metadata/section"/>
|
---|
125 | <xsl:with-param name="extra1" select="$refentry.metadata/date"/>
|
---|
126 | <xsl:with-param name="extra2" select="$refentry.metadata/source"/>
|
---|
127 | <xsl:with-param name="extra3" select="$refentry.metadata/manual"/>
|
---|
128 | </xsl:call-template>
|
---|
129 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
130 | <!-- * Set default hyphenation, justification, and line-breaking -->
|
---|
131 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
132 | <xsl:call-template name="set.default.formatting"/>
|
---|
133 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
134 | <!-- * Main body of man page -->
|
---|
135 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
136 | <xsl:apply-templates/>
|
---|
137 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
138 | <!-- * AUTHOR section -->
|
---|
139 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
140 | <xsl:call-template name="author.section">
|
---|
141 | <xsl:with-param name="info" select="$info"/>
|
---|
142 | <xsl:with-param name="parentinfo" select="$parentinfo"/>
|
---|
143 | </xsl:call-template>
|
---|
144 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
145 | <!-- * LINKS list (only if user wants links numbered and/or listed) -->
|
---|
146 | <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
147 | <xsl:if test="$man.links.list.enabled != 0 or
|
---|
148 | $man.links.are.numbered != 0">
|
---|
149 | <xsl:call-template name="links.list"/>
|
---|
150 | </xsl:if>
|
---|
151 | </xsl:variable> <!-- * end of manpage.contents -->
|
---|
152 |
|
---|
153 | <!-- * Prepare the page contents for final output, then store in -->
|
---|
154 | <!-- * $manpage.contents.prepared so the we can pass it on to the -->
|
---|
155 | <!-- * write.text.chunk() function -->
|
---|
156 | <xsl:variable name="manpage.contents.prepared">
|
---|
157 | <!-- * "Preparing" the page contents involves, at a minimum, -->
|
---|
158 | <!-- * doubling any backslashes found (so they aren't interpreted -->
|
---|
159 | <!-- * as roff escapes). -->
|
---|
160 | <!-- * -->
|
---|
161 | <!-- * If $charmap.enabled is true, "preparing" the page contents also -->
|
---|
162 | <!-- * involves applying a character map to convert Unicode symbols and -->
|
---|
163 | <!-- * special characters into corresponding roff escape sequences. -->
|
---|
164 | <xsl:call-template name="prepare.manpage.contents">
|
---|
165 | <xsl:with-param name="content" select="$manpage.contents"/>
|
---|
166 | </xsl:call-template>
|
---|
167 | </xsl:variable>
|
---|
168 |
|
---|
169 | <!-- * Write the prepared page contents to disk to create -->
|
---|
170 | <!-- * the final man page. -->
|
---|
171 | <xsl:call-template name="write.man.file">
|
---|
172 | <xsl:with-param name="name" select="$first.refname"/>
|
---|
173 | <xsl:with-param name="section" select="$refentry.metadata/section"/>
|
---|
174 | <xsl:with-param name="content" select="$manpage.contents.prepared"/>
|
---|
175 | </xsl:call-template>
|
---|
176 |
|
---|
177 | <!-- * Generate "stub" (alias) pages (if any needed) -->
|
---|
178 | <xsl:call-template name="write.stubs">
|
---|
179 | <xsl:with-param name="first.refname" select="$first.refname"/>
|
---|
180 | <xsl:with-param name="section" select="$refentry.metadata/section"/>
|
---|
181 | </xsl:call-template>
|
---|
182 |
|
---|
183 | </xsl:template>
|
---|
184 |
|
---|
185 | </xsl:stylesheet>
|
---|