~todd-deshane/openstack-manuals/working

« back to all changes in this revision

Viewing changes to doc/build/docbook-xsl-1.76.1/manpages/profile-docbook.xsl

  • Committer: Anne Gentle
  • Date: 2011-04-04 17:54:52 UTC
  • Revision ID: anne@openstack.org-20110404175452-gtth3hfrniqhpp5o
Switching from Ant builds to Maven, still working out kinks but should be functional

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 8841 2010-08-14 07:21:25Z mzjn $
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
 
  <xsl:include href="pi.xsl"/>
37
 
 
38
 
  <!-- * we rename the following just to avoid using params with "man" -->
39
 
  <!-- * prefixes in the table.xsl stylesheet (because that stylesheet -->
40
 
  <!-- * can potentially be reused for more than just man output) -->
41
 
  <xsl:param name="tbl.font.headings" select="$man.font.table.headings"/>
42
 
  <xsl:param name="tbl.font.title" select="$man.font.table.title"/>
43
 
 
44
 
  <xsl:param name="stylesheet.result.type" select="'manpages'"/>
45
 
 
46
 
  <!-- ==================================================================== -->
47
 
 
48
 
  <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="/">
49
 
    <!-- * Get a title for current doc so that we let the user -->
50
 
    <!-- * know what document we are processing at this point. -->
51
 
    <xsl:variable name="doc.title">
52
 
      <xsl:call-template name="get.doc.title"/>
53
 
    </xsl:variable>
54
 
    <xsl:choose>
55
 
      <!-- * when we find a namespaced document, strip the -->
56
 
      <!-- * namespace and then continue processing it. -->
57
 
      <xsl:when test="false()"/>
58
 
      <xsl:when test="//*[local-name() = 'refentry']">
59
 
        <!-- * Check to see if we have any refentry children in this -->
60
 
        <!-- * document; if so, process them. The reason we use -->
61
 
        <!-- * local-name()=refentry (instead of just //refentry) to to -->
62
 
        <!-- * check for refentry children is because this stylsheet is -->
63
 
        <!-- * also post-processed by the stylesheet build to create the -->
64
 
        <!-- * manpages/profile-docbook.xsl, and the refentry child check -->
65
 
        <!-- * in the profile-docbook.xsl stylesheet won't work if we do -->
66
 
        <!-- * a simple //refentry check. -->
67
 
        <xsl:apply-templates select="$profiled-nodes//refentry"/>
68
 
        <!-- * if $man.output.manifest.enabled is non-zero, -->
69
 
        <!-- * generate a manifest file -->
70
 
        <xsl:if test="not($man.output.manifest.enabled = 0)">
71
 
          <xsl:call-template name="generate.manifest">
72
 
            <xsl:with-param name="filename">
73
 
              <xsl:choose>
74
 
                <xsl:when test="not($man.output.manifest.filename = '')">
75
 
                  <!-- * If a name for the manifest file is specified, -->
76
 
                  <!-- * use that name. -->
77
 
                  <xsl:value-of select="$man.output.manifest.filename"/>
78
 
                </xsl:when>
79
 
                <xsl:otherwise>
80
 
                  <!-- * Otherwise, if user has unset -->
81
 
                  <!-- * $man.output.manifest.filename, default to -->
82
 
                  <!-- * using "MAN.MANIFEST" as the filename. Because -->
83
 
                  <!-- * $man.output.manifest.enabled is non-zero and -->
84
 
                  <!-- * so we must have a filename in order to -->
85
 
                  <!-- * generate the manifest. -->
86
 
                  <xsl:text>MAN.MANIFEST</xsl:text>
87
 
                </xsl:otherwise>
88
 
              </xsl:choose>
89
 
            </xsl:with-param>
90
 
          </xsl:call-template>
91
 
        </xsl:if>
92
 
      </xsl:when>
93
 
      <xsl:otherwise>
94
 
        <!-- * Otherwise, the document does not contain any -->
95
 
        <!-- * refentry elements, so log/emit message and stop. -->
96
 
        <xsl:call-template name="log.message">
97
 
          <xsl:with-param name="level">Erro</xsl:with-param>
98
 
          <xsl:with-param name="source" select="$doc.title"/>
99
 
          <xsl:with-param name="context-desc">
100
 
            <xsl:text> no refentry</xsl:text>
101
 
          </xsl:with-param>
102
 
          <xsl:with-param name="message">
103
 
            <xsl:text>No refentry elements found</xsl:text>
104
 
            <xsl:if test="$doc.title != ''">
105
 
            <xsl:text> in "</xsl:text>
106
 
              <xsl:choose>
107
 
                <xsl:when test="string-length($doc.title) &gt; 30">
108
 
                  <xsl:value-of select="substring($doc.title,1,30)"/>
109
 
                  <xsl:text>...</xsl:text>
110
 
                </xsl:when>
111
 
                <xsl:otherwise>
112
 
                  <xsl:value-of select="$doc.title"/>
113
 
                </xsl:otherwise>
114
 
              </xsl:choose>
115
 
              <xsl:text>"</xsl:text>
116
 
            </xsl:if>
117
 
            <xsl:text>.</xsl:text>
118
 
          </xsl:with-param>
119
 
        </xsl:call-template>
120
 
      </xsl:otherwise>
121
 
    </xsl:choose>
122
 
  </xsl:template>
123
 
 
124
 
  <!-- ============================================================== -->
125
 
 
126
 
  <xsl:template match="refentry">
127
 
    <xsl:param name="lang">
128
 
      <xsl:call-template name="l10n.language"/>
129
 
    </xsl:param>
130
 
    <!-- * Just use the first refname found as the "name" of the man -->
131
 
    <!-- * page (which may different from the "title"...) -->
132
 
    <xsl:variable name="first.refname" select="refnamediv[1]/refname[1]"/>
133
 
 
134
 
    <xsl:call-template name="root.messages">
135
 
      <xsl:with-param name="refname" select="$first.refname"/>
136
 
    </xsl:call-template>
137
 
 
138
 
    <!-- * Because there are several times when we need to check *info of -->
139
 
    <!-- * each refentry and its ancestors, we get those and store the -->
140
 
    <!-- * data from them as a node-set in memory. -->
141
 
 
142
 
    <!-- * Make a node-set with contents of *info -->
143
 
    <xsl:variable name="get.info" select="ancestor-or-self::*/*[substring(local-name(),                           string-length(local-name()) - 3) = 'info']"/>
144
 
    <xsl:variable name="info" select="exsl:node-set($get.info)"/>
145
 
 
146
 
    <!-- * The get.refentry.metadata template is in -->
147
 
    <!-- * ../common/refentry.xsl. It looks for metadata in $info -->
148
 
    <!-- * and in various other places and then puts it into a form -->
149
 
    <!-- * that's easier for us to digest. -->
150
 
    <xsl:variable name="get.refentry.metadata">
151
 
      <xsl:call-template name="get.refentry.metadata">
152
 
        <xsl:with-param name="refname" select="$first.refname"/>
153
 
        <xsl:with-param name="info" select="$info"/>
154
 
        <xsl:with-param name="prefs" select="$refentry.metadata.prefs"/>
155
 
      </xsl:call-template>
156
 
    </xsl:variable>
157
 
    <xsl:variable name="refentry.metadata" select="exsl:node-set($get.refentry.metadata)"/>
158
 
 
159
 
    <!-- * Assemble the various parts into a complete page, then store into -->
160
 
    <!-- * $manpage.contents so that we can manipluate them further. -->
161
 
    <xsl:variable name="manpage.contents">
162
 
      <!-- * preprocessor invocation (need for legacy AT&T troff use) -->
163
 
      <!-- * this tells troff to pre-process the page through tbl(1) -->
164
 
      <!-- * (groff can figure it out automatically, but AT&T troff can't) -->
165
 
      <xsl:text>'\" t
166
 
</xsl:text>
167
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
168
 
      <!-- * top.comment = commented-out section at top of roff source -->
169
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
170
 
      <xsl:call-template name="top.comment">
171
 
        <xsl:with-param name="info" select="$info"/>
172
 
        <xsl:with-param name="date" select="$refentry.metadata/date"/>
173
 
        <xsl:with-param name="title" select="$refentry.metadata/title"/>
174
 
        <xsl:with-param name="manual" select="$refentry.metadata/manual"/>
175
 
        <xsl:with-param name="source" select="$refentry.metadata/source"/>
176
 
        <xsl:with-param name="refname" select="$first.refname"/>
177
 
      </xsl:call-template>
178
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
179
 
      <!-- * TH.title.line = title line in header/footer of man page -->
180
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
181
 
      <xsl:call-template name="TH.title.line">
182
 
        <!-- * .TH TITLE  section  extra1  extra2  extra3 -->
183
 
        <!-- *  -->
184
 
        <!-- * According to the man(7) man page: -->
185
 
        <!-- *  -->
186
 
        <!-- * extra1 = date,   "the date of the last revision" -->
187
 
        <!-- * extra2 = source, "the source of the command" -->
188
 
        <!-- * extra3 = manual, "the title of the manual -->
189
 
        <!-- *                  (e.g., Linux Programmer's Manual)" -->
190
 
        <!-- * -->
191
 
        <!-- * So, we end up with: -->
192
 
        <!-- *  -->
193
 
        <!-- * .TH TITLE  section  date  source  manual -->
194
 
        <!-- * -->
195
 
        <xsl:with-param name="title" select="$refentry.metadata/title"/>
196
 
        <xsl:with-param name="section" select="$refentry.metadata/section"/>
197
 
        <xsl:with-param name="extra1" select="$refentry.metadata/date"/>
198
 
        <xsl:with-param name="extra2" select="$refentry.metadata/source"/>
199
 
        <xsl:with-param name="extra3" select="$refentry.metadata/manual"/>
200
 
      </xsl:call-template>
201
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
202
 
      <!-- * (re)define some macros -->
203
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
204
 
      <xsl:call-template name="define.portability.macros"/>
205
 
      <xsl:if test="not($man.output.better.ps.enabled = 0)">
206
 
        <xsl:call-template name="define.macros"/>
207
 
      </xsl:if>
208
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
209
 
      <!-- * Set default hyphenation, justification, indentation, and -->
210
 
      <!-- * line-breaking -->
211
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
212
 
      <xsl:call-template name="set.default.formatting"/>
213
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
214
 
      <!-- * Main body of man page -->
215
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
216
 
      <xsl:text>.\" -----------------------------------------------------------------
217
 
</xsl:text>
218
 
      <xsl:text>.\" * MAIN CONTENT STARTS HERE *
219
 
</xsl:text>
220
 
      <xsl:text>.\" -----------------------------------------------------------------
221
 
</xsl:text>
222
 
      <xsl:apply-templates/>
223
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
224
 
      <!-- * AUTHOR section -->
225
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
226
 
      <xsl:if test="not($man.authors.section.enabled = 0)">
227
 
        <xsl:call-template name="author.section">
228
 
          <xsl:with-param name="info" select="$info"/>
229
 
        </xsl:call-template>
230
 
      </xsl:if>
231
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
232
 
      <!-- * COPYRIGHT section -->
233
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
234
 
      <xsl:if test="not($man.copyright.section.enabled = 0)">
235
 
        <xsl:call-template name="copyright.section">
236
 
          <xsl:with-param name="info" select="$info"/>
237
 
        </xsl:call-template>
238
 
      </xsl:if>
239
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
240
 
      <!-- * NOTES list (only if user wants endnotes numbered and/or listed) -->
241
 
      <!-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
242
 
      <xsl:if test="$man.endnotes.list.enabled != 0 or                     $man.endnotes.are.numbered != 0">
243
 
        <xsl:call-template name="endnotes.list"/>
244
 
      </xsl:if>
245
 
    </xsl:variable> <!-- * end of manpage.contents -->
246
 
 
247
 
    <!-- * Prepare the page contents for final output, then store in -->
248
 
    <!-- * $manpage.contents.prepared so the we can pass it on to the -->
249
 
    <!-- * write.text.chunk() function -->
250
 
    <xsl:variable name="manpage.contents.prepared">
251
 
      <!-- * "Preparing" the page contents involves, at a minimum, -->
252
 
      <!-- * doubling any backslashes found (so they aren't interpreted -->
253
 
      <!-- * as roff escapes). -->
254
 
      <!-- * -->
255
 
      <!-- * If $charmap.enabled is true, "preparing" the page contents also -->
256
 
      <!-- * involves applying a character map to convert Unicode symbols and -->
257
 
      <!-- * special characters into corresponding roff escape sequences. -->
258
 
      <xsl:call-template name="prepare.manpage.contents">
259
 
        <xsl:with-param name="content" select="$manpage.contents"/>
260
 
      </xsl:call-template>
261
 
    </xsl:variable>
262
 
    
263
 
    <!-- * Write the prepared page contents to disk to create -->
264
 
    <!-- * the final man page. -->
265
 
    <xsl:call-template name="write.man.file">
266
 
      <xsl:with-param name="name" select="$first.refname"/>
267
 
      <xsl:with-param name="section" select="$refentry.metadata/section"/>
268
 
      <xsl:with-param name="lang" select="$lang"/>
269
 
      <xsl:with-param name="content" select="$manpage.contents.prepared"/>
270
 
    </xsl:call-template>
271
 
 
272
 
    <!-- * Generate "stub" (alias) pages (if any needed) -->
273
 
    <xsl:call-template name="write.stubs">
274
 
      <xsl:with-param name="first.refname" select="$first.refname"/>
275
 
      <xsl:with-param name="section" select="$refentry.metadata/section"/>
276
 
      <xsl:with-param name="lang" select="$lang"/>
277
 
    </xsl:call-template>
278
 
 
279
 
  </xsl:template>
280
 
 
281
 
</xsl:stylesheet>