Doc: Initiate transition to next generation documentation
[shapes.git] / doc / parts / man / formats / html.xsl
blob92d1d87fd60490335b4d605f23d48abd27eda47b
1 <?xml version="1.0" encoding="UTF-8"?>
3 <!-- This file is part of Shapes. -->
4 <!-- -->
5 <!-- Shapes is free software: you can redistribute it and/or modify -->
6 <!-- it under the terms of the GNU General Public License as published by -->
7 <!-- the Free Software Foundation, either version 3 of the License, or -->
8 <!-- any later version. -->
9 <!-- -->
10 <!-- Shapes is distributed in the hope that it will be useful, -->
11 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
12 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
13 <!-- GNU General Public License for more details. -->
14 <!-- -->
15 <!-- You should have received a copy of the GNU General Public License -->
16 <!-- along with Shapes. If not, see <http://www.gnu.org/licenses/>. -->
17 <!-- -->
18 <!-- Copyright 2008 Henrik Tidefelt -->
20 <xsl:stylesheet
21 version="2.0"
22 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
23 xmlns="http://www.w3.org/1999/xhtml"
25 <xsl:output method="xml" indent="no"
26 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
27 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
30 <xsl:include href="../../formats/html.xsl" />
31 <xsl:include href="../../formats/bindings-html.xsl" />
33 <xsl:template match="/man">
34 <html>
35 <head>
36 <title><xsl:apply-templates select="manhead/center-header" /></title>
37 <xsl:element name="link">
38 <xsl:attribute name="rel">stylesheet</xsl:attribute>
39 <xsl:attribute name="href"><xsl:value-of select="/book/base/@href" />shapes.css</xsl:attribute>
40 </xsl:element>
41 </head>
42 <body>
43 <xsl:call-template name="head-navigation" />
44 <xsl:apply-templates select="manhead" />
45 <hr class="thick"/>
46 <xsl:for-each select="section">
47 <xsl:choose>
48 <xsl:when test="@id">
49 <xsl:element name="a">
50 <xsl:attribute name="name"><xsl:call-template name="id-to-anchor-name"><xsl:with-param name="id"><xsl:value-of select="@id" /></xsl:with-param></xsl:call-template></xsl:attribute>
51 <h3><xsl:apply-templates select="title" /></h3>
52 </xsl:element>
53 </xsl:when>
54 <xsl:otherwise>
55 <h3><xsl:apply-templates select="title" /></h3>
56 </xsl:otherwise>
57 </xsl:choose>
58 <xsl:apply-templates select="top/*" />
59 <xsl:apply-templates select="body/*" />
60 <xsl:for-each select="section">
61 <xsl:choose>
62 <xsl:when test="@id">
63 <xsl:element name="a">
64 <xsl:attribute name="name"><xsl:call-template name="id-to-anchor-name"><xsl:with-param name="id"><xsl:value-of select="@id" /></xsl:with-param></xsl:call-template></xsl:attribute>
65 <h4><xsl:apply-templates select="title" /></h4>
66 </xsl:element>
67 </xsl:when>
68 <xsl:otherwise>
69 <h4><xsl:apply-templates select="title" /></h4>
70 </xsl:otherwise>
71 </xsl:choose>
72 <xsl:apply-templates select="top/*" />
73 <xsl:apply-templates select="body/*" />
74 </xsl:for-each>
75 </xsl:for-each>
76 <xsl:call-template name="SF-placeholder" />
77 </body>
78 </html>
79 </xsl:template>
81 <xsl:template match="manhead">
82 <h2><xsl:apply-templates select="center-header" /></h2>
83 <div class="p">This page corresponds to the man page <b><xsl:value-of select="@prog-name" /></b>(<xsl:value-of select="@section" />), dated <xsl:value-of select="@modification-date" />.</div>
84 <div class="p"><em><b>Note:</b> The examples here may be presented using characters that may not be available in the man page format. Hence, the examples may be presented differently in the man page.</em></div>
85 </xsl:template>
87 <xsl:template match="synopsis-table">
88 <xsl:for-each select="synopsis-case">
89 <div class="p"><xsl:apply-templates/></div>
90 </xsl:for-each>
91 </xsl:template>
93 <xsl:template match="see-also-items">
94 <div class="p">
95 <xsl:for-each select="see-also"><xsl:apply-templates/><xsl:text> </xsl:text></xsl:for-each>
96 </div>
97 </xsl:template>
98 <xsl:template match="manpage[@tool,@section]">
99 <xsl:element name="a"><xsl:attribute name="href">http://www.google.com/search?btnI=I%27m%20Feeling%20Lucky&amp;q=%22man%20page%22%20%22<xsl:value-of select="encode-for-uri(@tool)" />(<xsl:value-of select="@section" />)%22</xsl:attribute><b><xsl:value-of select="@tool" /></b>(<xsl:value-of select="@section" />)</xsl:element>
100 </xsl:template>
102 <xsl:template match="man-only">
103 <!-- Ignore in HTML output -->
104 </xsl:template>
106 <xsl:template match="env-variable-list">
107 <ul><xsl:apply-templates /></ul>
108 </xsl:template>
109 <xsl:template match="env-variable-item[@name]">
110 <li>
111 <xsl:element name="a">
112 <xsl:attribute name="name"><xsl:call-template name="env-var-to-anchor-name"><xsl:with-param name="id"><xsl:value-of select="@name" /></xsl:with-param></xsl:call-template></xsl:attribute>
113 <b><xsl:value-of select="@name" /></b>
114 </xsl:element>
115 <xsl:apply-templates select="description/*"/>
116 </li>
117 </xsl:template>
119 <xsl:template match="command-line-option-list">
120 <ul><xsl:apply-templates /></ul>
121 </xsl:template>
122 <xsl:template match="command-line-item">
123 <li>
124 <xsl:if test="./@id">
125 <xsl:element name="a">
126 <xsl:attribute name="name"><xsl:call-template name="id-to-anchor-name"><xsl:with-param name="id"><xsl:value-of select="@id" /></xsl:with-param></xsl:call-template></xsl:attribute>
127 </xsl:element>
128 </xsl:if>
129 <xsl:apply-templates select="parameters" />
130 <xsl:apply-templates select="nosep-parameter" />
131 <xsl:apply-templates select="description/*"/>
132 </li>
133 </xsl:template>
134 <xsl:template match="command-line-tolparam[@name]">
135 <xsl:variable name="tolname">
136 <xsl:value-of select="@name" />
137 </xsl:variable>
138 <xsl:apply-templates select="/man/external/tolerance-parameter[@name=$tolname]" />
139 </xsl:template>
140 <xsl:template match="command-line-tolparam-remaining">
141 <xsl:for-each select="/man/external/tolerance-parameter">
142 <xsl:variable name="tolname">
143 <xsl:value-of select="@name" />
144 </xsl:variable>
145 <xsl:if test="not(//command-line-tolparam[@name=$tolname])">
146 <xsl:apply-templates select="." />
147 </xsl:if>
148 </xsl:for-each>
149 </xsl:template>
151 <xsl:template match="command-line-item/parameters[@flag]">
152 <b><xsl:value-of select="@flag" /></b> <xsl:apply-templates /><br />
153 </xsl:template>
155 <xsl:template match="command-line-item/nosep-parameter[@flag]">
156 <b><xsl:value-of select="@flag" /></b><span class="program-param replacable"><xsl:value-of select="."/></span><br />
157 </xsl:template>
159 <xsl:template match="tolerance-parameter[@name]">
160 <li>
161 <xsl:apply-templates select="command-line-option-derived" />
162 <xsl:apply-templates select="command-line-option" />
163 <xsl:apply-templates select="description/*"/>
164 <div class="p">Default value: <xsl:apply-templates select="default" /></div>
165 </li>
166 </xsl:template>
168 <xsl:template match="tolerance-parameter/command-line-option[@flag]">
169 <b><xsl:value-of select="@flag" /></b> <xsl:apply-templates /><br />
170 </xsl:template>
171 <xsl:template match="tolerance-parameter[@name]/command-line-option-derived">
172 <b>--<xsl:value-of select="../@name" />=</b><span class="program-param replacable"><xsl:value-of select="." /></span><br />
173 </xsl:template>
175 <xsl:template match="exit-code-list">
176 <ul>
177 <xsl:apply-templates select="/man/external/exit-code" />
178 </ul>
179 </xsl:template>
182 <xsl:template match="exit-code[@value]">
183 <li>
184 <b><xsl:apply-templates select="@value" /><xsl:apply-templates select="short" /></b><br />
185 <xsl:apply-templates select="description/*" />
186 </li>
187 </xsl:template>
189 <xsl:template match="prog-name[@class='other']"><xsl:value-of select="." /></xsl:template>
190 <xsl:template match="prog-name"><b><xsl:value-of select="." /></b></xsl:template>
192 <xsl:template match="synopsis-case/replacable"><span class="program-param replacable"><xsl:value-of select="." /></span></xsl:template>
193 <xsl:template match="parameters/replacable"><span class="program-param replacable"><xsl:value-of select="." /></span></xsl:template>
194 <xsl:template match="command-line-option/replacable"><span class="program-param replacable"><xsl:value-of select="." /></span></xsl:template>
196 </xsl:stylesheet>