1<!--
2 - Copyright (C) 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
3 -
4 - Permission to use, copy, modify, and/or distribute this software for any
5 - purpose with or without fee is hereby granted, provided that the above
6 - copyright notice and this permission notice appear in all copies.
7 -
8 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 - AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 - PERFORMANCE OF THIS SOFTWARE.
15-->
16
17<!-- Id: isc-manpage.xsl.in,v 1.9 2007/06/18 23:47:34 tbox Exp  -->
18
19<!-- ISC customizations for Docbook-XSL manual page generator. -->
20
21<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
22
23  <!-- Import the Docbook manpages stuff -->
24  <xsl:import href="@XSLT_DOCBOOK_STYLE_MAN@"/>
25
26  <!-- Include our copyright generator -->
27  <xsl:include href="copyright.xsl"/>
28
29  <!-- Set comment string for this output format -->
30  <xsl:param name="isc.copyright.leader">.\" </xsl:param>
31
32  <!-- We're not writing any kind of SGML, thanks -->
33  <xsl:output method="text" encoding="us-ascii"/>
34
35  <!-- ANSI C function prototypes, please -->
36  <xsl:param name="funcsynopsis.style">ansi</xsl:param>
37
38  <!-- Use ranges when constructing copyrights -->
39  <xsl:param name="make.year.ranges" select="1"/>
40
41  <!-- Stuff we want in our nroff preamble. -->
42  <xsl:variable name="isc.nroff.preamble">
43    <xsl:text>.\"&#10;</xsl:text>
44    <xsl:text>.\" &#36;Id&#36;&#10;</xsl:text>
45    <xsl:text>.\"&#10;</xsl:text>
46    <xsl:text>.hy 0&#10;</xsl:text>
47    <xsl:text>.ad l&#10;</xsl:text>
48  </xsl:variable>
49
50  <!--
51    - Override Docbook template to insert our copyright,
52    - disable chunking, and suppress output of .so files.
53   -->
54  <xsl:template name="write.text.chunk">
55    <xsl:param name="content"/>
56    <xsl:if test="substring($content, 1, 4) != '.so ' or
57		  substring-after($content, '&#10;') != ''">
58      <xsl:call-template name="isc.no.blanks">
59        <xsl:with-param name="text" select="
60		concat($isc.copyright,
61		       $isc.nroff.preamble,
62		       $content)"/>
63      </xsl:call-template>
64    </xsl:if>
65  </xsl:template>
66
67  <!--
68    - Suppress blank lines in nroff source we output.
69   -->
70  <xsl:template name="isc.no.blanks">
71    <xsl:param name="text"/>
72    <xsl:choose>
73      <xsl:when test="contains($text, '&#10;')">
74        <xsl:call-template name="isc.no.blanks">
75	  <xsl:with-param name="text"
76	                  select="substring-before($text, '&#10;')"/>
77        </xsl:call-template>
78	<xsl:call-template name="isc.no.blanks">
79	  <xsl:with-param name="text"
80			  select="substring-after($text, '&#10;')"/>
81        </xsl:call-template>
82      </xsl:when>
83      <xsl:when test="translate($text, '&#9;&#32;', '')">
84        <xsl:value-of select="$text"/>
85	<xsl:text>&#10;</xsl:text>
86      </xsl:when>
87    </xsl:choose>
88  </xsl:template>
89
90  <!--
91    - Override Docbook template to change formatting.
92    - We just want the element name in boldface, no subsection header.
93   -->
94  <xsl:template match="caution|important|note|tip|warning">
95    <xsl:text>&#10;.RS&#10;.B "</xsl:text>
96    <!-- capitalize word -->
97    <xsl:value-of
98      select="translate (substring (name(.), 1, 1), 'cintw', 'CINTW')" />
99    <xsl:value-of select="substring (name(), 2)" />
100    <xsl:if test="title">
101      <xsl:text>: </xsl:text>
102      <xsl:value-of select="title[1]"/>
103    </xsl:if>
104    <xsl:text>:"&#10;</xsl:text>
105    <xsl:apply-templates/>
106    <xsl:text>&#10;.RE&#10;</xsl:text>
107  </xsl:template>
108
109  <!--
110    - Override template to change formatting.
111    - We don't want hyphenation or justification.
112   -->
113  <xsl:template match="cmdsynopsis">
114    <xsl:text>.HP </xsl:text>
115    <xsl:value-of select="string-length (normalize-space (command)) + 1"/>
116    <xsl:text>&#10;</xsl:text>
117    <xsl:apply-templates/>
118    <xsl:text>&#10;</xsl:text>
119  </xsl:template>
120
121  <!--
122    - Override template to change formatting.
123    - We don't want hyphenation or justification.
124   -->
125  <xsl:template match="funcsynopsis">
126    <xsl:apply-templates/>
127  </xsl:template>
128
129  <!--
130    - Override template to change formatting.
131    - Line breaks in funcsynopsisinfo are significant.
132   -->
133  <xsl:template match="funcsynopsisinfo">
134    <xsl:text>&#10;.nf&#10;</xsl:text>
135    <xsl:apply-templates/>
136    <xsl:text>&#10;.fi&#10;</xsl:text>
137  </xsl:template>
138
139</xsl:stylesheet>
140
141<!--
142  - Local variables:
143  - mode: sgml
144  - End:
145 -->
146