Debian Codegraph @

docs/xsl-generic/manpages/profile-docbook.xsl

raw
1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!--This file was created automatically by xsl2profile-->
3 <!--from the DocBook XSL stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exslt="http://exslt.org/common" exslt:dummy="dummy" ng:dummy="dummy" db:dummy="dummy" extension-element-prefixes="exslt" exclude-result-prefixes="exsl exslt" version="1.0">
5
6 <xsl:import href="../html/docbook.xsl"/>
7 <xsl:import href="../html/manifest.xsl"/>
8 <!-- * html-synop.xsl file is generated by build -->
9 <xsl:import href="html-synop.xsl"/>
10 <xsl:output method="text" encoding="UTF-8" indent="no"/>
11 <!-- ********************************************************************
12 $Id: docbook.xsl 7153 2007-07-26 14:08:55Z xmldoc $
13 ********************************************************************
14
15 This file is part of the XSL DocBook Stylesheet distribution.
16 See ../README or http://docbook.sf.net/release/xsl/current/ for
17 copyright and other information.
18
19 ******************************************************************** -->
20
21 <!-- ==================================================================== -->
22
23 <xsl:include href="../common/refentry.xsl"/>
24 <xsl:include href="../common/charmap.xsl"/>
25 <xsl:include href="param.xsl"/>
26 <xsl:include href="utility.xsl"/>
27 <xsl:include href="info.xsl"/>
28 <xsl:include href="other.xsl"/>
29 <xsl:include href="refentry.xsl"/>
30 <xsl:include href="block.xsl"/>
31 <xsl:include href="inline.xsl"/>
32 <xsl:include href="synop.xsl"/>
33 <xsl:include href="lists.xsl"/>
34 <xsl:include href="endnotes.xsl"/>
35 <xsl:include href="table.xsl"/>
36
37 <!-- * we rename the following just to avoid using params with "man" -->
38 <!-- * prefixes in the table.xsl stylesheet (because that stylesheet -->
39 <!-- * can potentially be reused for more than just man output) -->
40 <xsl:param name="tbl.font.headings" select="$man.font.table.headings"/>
41 <xsl:param name="tbl.font.title" select="$man.font.table.title"/>
42
43 <!-- ==================================================================== -->
44
45 <xslo:include xmlns:xslo="http://www.w3.org/1999/XSL/Transform" href="../profiling/profile-mode.xsl"/><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content"><xslo:choose><xslo:when test="*/self::ng:* or */self::db:*"><xslo:message>Note: namesp. cut : stripped namespace before processing</xslo:message><xslo:variable name="stripped-content"><xslo:apply-templates select="/" mode="stripNS"/></xslo:variable><xslo:message>Note: namesp. cut : processing stripped document</xslo:message><xslo:apply-templates select="exslt:node-set($stripped-content)" mode="profile"/></xslo:when><xslo:otherwise><xslo:apply-templates select="/" mode="profile"/></xslo:otherwise></xslo:choose></xslo:variable><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes" select="exslt:node-set($profiled-content)"/><xsl:template match="/">
46 <!-- * Get a title for current doc so that we let the user -->
47 <!-- * know what document we are processing at this point. -->
48 <xsl:variable name="doc.title">
49 <xsl:call-template name="get.doc.title"/>
50 </xsl:variable>
51 <xsl:choose>
52 <!-- * when we find a namespaced document, strip the -->
53 <!-- * namespace and then continue processing it. -->
54 <xsl:when test="false()"/>
55 <xsl:when test="//*[local-name() = 'refentry']">
56 <!-- * Check to see if we have any refentry children in this -->
57 <!-- * document; if so, process them. The reason we use -->
58 <!-- * local-name()=refentry (instead of just //refentry) to to -->
59 <!-- * check for refentry children is because this stylsheet is -->
60 <!-- * also post-processed by the stylesheet build to create the -->
61 <!-- * manpages/profile-docbook.xsl, and the refentry child check -->
62 <!-- * in the profile-docbook.xsl stylesheet won't work if we do -->
63 <!-- * a simple //refentry check. -->
64 <xsl:apply-templates select="$profiled-nodes//refentry"/>
65 <!-- * if $man.output.manifest.enabled is non-zero, -->
66 <!-- * generate a manifest file -->
67 <xsl:if test="not($man.output.manifest.enabled = 0)">
68 <xsl:call-template name="generate.manifest">
69 <xsl:with-param name="filename">
70 <xsl:choose>
71 <xsl:when test="not($man.output.manifest.filename = '')">
72 <!-- * If a name for the manifest file is specified, -->
73 <!-- * use that name. -->
74 <xsl:value-of select="$man.output.manifest.filename"/>
75 </xsl:when>
76 <xsl:otherwise>
77 <!-- * Otherwise, if user has unset -->
78 <!-- * $man.output.manifest.filename, default to -->
79 <!-- * using "MAN.MANIFEST" as the filename. Because -->
80 <!-- * $man.output.manifest.enabled is non-zero and -->
81 <!-- * so we must have a filename in order to -->
82 <!-- * generate the manifest. -->
83 <xsl:text>MAN.MANIFEST</xsl:text>
84 </xsl:otherwise>
85 </xsl:choose>
86 </xsl:with-param>
87 </xsl:call-template>
88 </xsl:if>
89 </xsl:when>
90 <xsl:otherwise>
91 <!-- * Otherwise, the document does not contain any -->
92 <!-- * refentry elements, so log/emit message and stop. -->
93 <xsl:call-template name="log.message">
94 <xsl:with-param name="level">Erro</xsl:with-param>
95 <xsl:with-param name="source" select="$doc.title"/>
96 <xsl:with-param name="context-desc">
97 <xsl:text> no refentry</xsl:text>
98 </xsl:with-param>
99 <xsl:with-param name="message">
100 <xsl:text>No refentry elements found</xsl:text>
101 <xsl:if test="$doc.title != ''">
102 <xsl:text> in "</xsl:text>
103 <xsl:choose>
104 <xsl:when test="string-length($doc.title) &gt; 30">
105 <xsl:value-of select="substring($doc.title,1,30)"/>
106 <xsl:text>...</xsl:text>
107 </xsl:when>
108 <xsl:otherwise>
109 <xsl:value-of select="$doc.title"/>
110 </xsl:otherwise>
111 </xsl:choose>
112 <xsl:text>"</xsl:text>
113 </xsl:if>
114 <xsl:text>.</xsl:text>
115 </xsl:with-param>
116 </xsl:call-template>
117 </xsl:otherwise>
118 </xsl:choose>
119 </xsl:template>
120
121 <!-- ============================================================== -->
122
123 <xsl:template match="refentry">
124 <xsl:param name="lang">
125 <xsl:call-template name="l10n.language"/>
126 </xsl:param>
127 <!-- * Just use the first refname found as the "name" of the man -->
128 <!-- * page (which may different from the "title"...) -->
129 <xsl:variable name="first.refname" select="refnamediv[1]/refname[1]"/>
130
131 <xsl:call-template name="root.messages">
132 <xsl:with-param name="refname" select="$first.refname"/>
133 </xsl:call-template>
134
135 <!-- * Because there are several times when we need to check *info of -->
136 <!-- * each refentry and its ancestors, we get those and store the -->
137 <!-- * data from them as a node-set in memory. -->
138
139 <!-- * Make a node-set with contents of *info -->
140 <xsl:variable name="get.info" select="ancestor-or-self::*/*[substring(local-name(), string-length(local-name()) - 3) = 'info']"/>
141 <xsl:variable name="info" select="exsl:node-set($get.info)"/>
142
143 <!-- * The get.refentry.metadata template is in -->
144 <!-- * ../common/refentry.xsl. It looks for metadata in $info -->
145 <!-- * and in various other places and then puts it into a form -->
146 <!-- * that's easier for us to digest. -->
147 <xsl:variable name="get.refentry.metadata">
148 <xsl:call-template name="get.refentry.metadata">
149 <xsl:with-param name="refname" select="$first.refname"/>
150 <xsl:with-param name="info" select="$info"/>
151 <xsl:with-param name="prefs" select="$refentry.metadata.prefs"/>
152 </xsl:call-template>
153 </xsl:variable>
154 <xsl:variable name="refentry.metadata" select="exsl:node-set($get.refentry.metadata)"/>
155
156 <!-- * Assemble the various parts into a complete page, then store into -->
157 <!-- * $manpage.contents so that we can manipluate them further. -->
158 <xsl:variable name="manpage.contents">
159 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
160 <!-- * top.comment = commented-out section at top of roff source -->
161 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
162 <xsl:call-template name="top.comment">
163 <xsl:with-param name="info" select="$info"/>
164 <xsl:with-param name="date" select="$refentry.metadata/date"/>
165 <xsl:with-param name="title" select="$refentry.metadata/title"/>
166 <xsl:with-param name="manual" select="$refentry.metadata/manual"/>
167 <xsl:with-param name="source" select="$refentry.metadata/source"/>
168 </xsl:call-template>
169 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
170 <!-- * TH.title.line = title line in header/footer of man page -->
171 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
172 <xsl:call-template name="TH.title.line">
173 <!-- * .TH TITLE section extra1 extra2 extra3 -->
174 <!-- * -->
175 <!-- * According to the man(7) man page: -->
176 <!-- * -->
177 <!-- * extra1 = date, "the date of the last revision" -->
178 <!-- * extra2 = source, "the source of the command" -->
179 <!-- * extra3 = manual, "the title of the manual -->
180 <!-- * (e.g., Linux Programmer's Manual)" -->
181 <!-- * -->
182 <!-- * So, we end up with: -->
183 <!-- * -->
184 <!-- * .TH TITLE section date source manual -->
185 <!-- * -->
186 <xsl:with-param name="title" select="$refentry.metadata/title"/>
187 <xsl:with-param name="section" select="$refentry.metadata/section"/>
188 <xsl:with-param name="extra1" select="$refentry.metadata/date"/>
189 <xsl:with-param name="extra2" select="$refentry.metadata/source"/>
190 <xsl:with-param name="extra3" select="$refentry.metadata/manual"/>
191 </xsl:call-template>
192 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
193 <!-- * Set default hyphenation, justification, indentation, and -->
194 <!-- * line-breaking -->
195 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
196 <xsl:call-template name="set.default.formatting"/>
197 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
198 <!-- * Main body of man page -->
199 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
200 <xsl:apply-templates/>
201 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
202 <!-- * AUTHOR section -->
203 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
204 <xsl:if test="not($man.authors.section.enabled = 0)">
205 <xsl:call-template name="author.section">
206 <xsl:with-param name="info" select="$info"/>
207 </xsl:call-template>
208 </xsl:if>
209 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
210 <!-- * COPYRIGHT section -->
211 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
212 <xsl:if test="not($man.copyright.section.enabled = 0)">
213 <xsl:call-template name="copyright.section">
214 <xsl:with-param name="info" select="$info"/>
215 </xsl:call-template>
216 </xsl:if>
217 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
218 <!-- * NOTES list (only if user wants endnotes numbered and/or listed) -->
219 <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
220 <xsl:if test="$man.endnotes.list.enabled != 0 or $man.endnotes.are.numbered != 0">
221 <xsl:call-template name="endnotes.list"/>
222 </xsl:if>
223 </xsl:variable> <!-- * end of manpage.contents -->
224
225 <!-- * Prepare the page contents for final output, then store in -->
226 <!-- * $manpage.contents.prepared so the we can pass it on to the -->
227 <!-- * write.text.chunk() function -->
228 <xsl:variable name="manpage.contents.prepared">
229 <!-- * "Preparing" the page contents involves, at a minimum, -->
230 <!-- * doubling any backslashes found (so they aren't interpreted -->
231 <!-- * as roff escapes). -->
232 <!-- * -->
233 <!-- * If $charmap.enabled is true, "preparing" the page contents also -->
234 <!-- * involves applying a character map to convert Unicode symbols and -->
235 <!-- * special characters into corresponding roff escape sequences. -->
236 <xsl:call-template name="prepare.manpage.contents">
237 <xsl:with-param name="content" select="$manpage.contents"/>
238 </xsl:call-template>
239 </xsl:variable>
240
241 <!-- * Write the prepared page contents to disk to create -->
242 <!-- * the final man page. -->
243 <xsl:call-template name="write.man.file">
244 <xsl:with-param name="name" select="$first.refname"/>
245 <xsl:with-param name="section" select="$refentry.metadata/section"/>
246 <xsl:with-param name="lang" select="$lang"/>
247 <xsl:with-param name="content" select="$manpage.contents.prepared"/>
248 </xsl:call-template>
249
250 <!-- * Generate "stub" (alias) pages (if any needed) -->
251 <xsl:call-template name="write.stubs">
252 <xsl:with-param name="first.refname" select="$first.refname"/>
253 <xsl:with-param name="section" select="$refentry.metadata/section"/>
254 <xsl:with-param name="lang" select="$lang"/>
255 </xsl:call-template>
256
257 </xsl:template>
258
259 </xsl:stylesheet>