1 <?xml version=
"1.0" encoding=
"ISO-8859-1"?>
2 <!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp
" ">]
>
4 <xsl:stylesheet version=
"1.0"
5 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform">
7 <!-- ****************************************************************
9 **************************************************************** -->
11 <xsl:template match=
"/">
13 <xsl:apply-templates select=
"@*|node()" />
17 <xsl:template match=
"article">
18 <html xmlns=
"http://www.w3.org/1999/xhtml">
20 <xsl:call-template mode=
"top" name=
"generate-html-head" />
24 <xsl:call-template mode=
"top" name=
"generate-html-body" />
29 <!-- ****************************************************************
30 Templates for mode="top".
31 **************************************************************** -->
33 <xsl:template mode=
"top" match=
"*" priority=
"-1">
34 <xsl:text>UNMANAGED ELEMENT
</xsl:text>
37 <xsl:template mode=
"top" name=
"generate-html-head">
38 <meta http-equiv=
"Content-Type" content=
"text/html; charset=iso-8859-1" />
40 <link rel=
"made" href=
"mailto:atf-devel AT NetBSD DOT org" />
41 <link rel=
"stylesheet" type=
"text/css" href=
"standalone.css" />
43 <xsl:apply-templates mode=
"html-head" />
46 <xsl:template mode=
"top" name=
"generate-html-body">
48 <xsl:apply-templates mode=
"header" />
52 <xsl:call-template mode=
"toc" name=
"generate-toc" />
55 <div class=
"contents">
56 <xsl:apply-templates mode=
"contents">
57 <xsl:with-param name=
"depth" select=
"0" />
58 </xsl:apply-templates>
62 <!-- ****************************************************************
63 Templates for mode="html-head".
64 **************************************************************** -->
66 <xsl:template mode=
"html-head" match=
"*" priority=
"-1">
67 <xsl:text>UNMANAGED ELEMENT
</xsl:text>
70 <xsl:template mode=
"html-head" match=
"articleinfo">
71 <title><xsl:value-of select=
"title" /></title>
74 <xsl:template mode=
"html-head" match=
"note|section|para" />
76 <!-- ****************************************************************
77 Templates for mode="header".
78 **************************************************************** -->
80 <xsl:template mode=
"header" match=
"*" priority=
"-1">
81 <xsl:text>UNMANAGED ELEMENT
</xsl:text>
84 <xsl:template mode=
"header" match=
"articleinfo">
86 <xsl:apply-templates mode=
"common" select=
"title" />
89 <xsl:apply-templates mode=
"common" select=
"author" />
93 <xsl:template mode=
"header" match=
"note|section|para" />
95 <!-- ****************************************************************
96 Templates for mode="toc".
97 **************************************************************** -->
99 <xsl:template mode=
"toc" match=
"*" priority=
"-1">
100 <xsl:text>UNMANAGED ELEMENT
</xsl:text>
103 <xsl:template mode=
"toc" name=
"generate-toc">
104 <h1><xsl:text>Contents
</xsl:text></h1>
106 <xsl:call-template mode=
"toc" name=
"generate-entries" />
109 <xsl:template mode=
"toc" name=
"generate-entries">
110 <xsl:if test=
"section">
112 <xsl:apply-templates mode=
"toc" select=
"section" />
117 <xsl:template mode=
"toc" match=
"section">
119 <p><a href=
"#{@id}"><xsl:value-of select=
"title" /></a></p>
120 <xsl:call-template mode=
"toc" name=
"generate-entries" />
124 <!-- ****************************************************************
125 Templates for mode="contents".
126 **************************************************************** -->
128 <xsl:template mode=
"contents" match=
"*" priority=
"-1">
129 <xsl:text>UNMANAGED ELEMENT
</xsl:text>
132 <xsl:template mode=
"contents" match=
"articleinfo" />
134 <xsl:template mode=
"contents" match=
"email">
135 <a href=
"mailto:{.}"><<xsl:apply-templates />></a>
138 <xsl:template mode=
"contents" match=
"emphasis">
140 <xsl:when test=
"@role = 'strong'">
141 <b><xsl:apply-templates mode=
"contents" /></b>
144 <i><xsl:apply-templates mode=
"contents" /></i>
149 <xsl:template mode=
"contents" match=
"filename">
150 <tt class=
"filename"><xsl:apply-templates mode=
"contents" /></tt>
153 <xsl:template mode=
"contents" name=
"gen-title">
155 <xsl:apply-templates mode=
"common" select=
"title" />
159 <xsl:template mode=
"contents" match=
"itemizedlist">
161 <xsl:apply-templates mode=
"contents" />
165 <xsl:template mode=
"contents" match=
"listitem">
167 <xsl:apply-templates mode=
"contents" />
171 <xsl:template mode=
"contents" match=
"literal">
172 <tt><xsl:apply-templates mode=
"contents" /></tt>
175 <xsl:template mode=
"contents" match=
"note">
177 <xsl:apply-templates />
181 <xsl:template mode=
"contents" match=
"orderedlist">
183 <xsl:apply-templates mode=
"contents" />
187 <xsl:template mode=
"contents" match=
"para">
188 <p xml:
space=
"preserve"><xsl:apply-templates mode=
"contents" /></p>
191 <xsl:template mode=
"contents" match=
"section">
192 <xsl:param name=
"depth" />
195 <xsl:when test=
"$depth = 0">
196 <h1><xsl:call-template mode=
"contents" name=
"gen-title" /></h1>
198 <xsl:when test=
"$depth = 1">
199 <h2><xsl:call-template mode=
"contents" name=
"gen-title" /></h2>
201 <xsl:when test=
"$depth = 2">
202 <h3><xsl:call-template mode=
"contents" name=
"gen-title" /></h3>
204 <xsl:when test=
"$depth = 3">
205 <h4><xsl:call-template mode=
"contents" name=
"gen-title" /></h4>
207 <xsl:when test=
"$depth = 4">
208 <h5><xsl:call-template mode=
"contents" name=
"gen-title" /></h5>
210 <xsl:when test=
"$depth = 5">
211 <h6><xsl:call-template mode=
"contents" name=
"gen-title" /></h6>
214 <!-- XXX Can we raise an error from XSLT? -->
215 <h6>ERROR; SECTION NESTING TOO DEEP
</h6>
219 <xsl:apply-templates mode=
"contents" select=
"*[position() > 1]">
220 <xsl:with-param name=
"depth" select=
"$depth + 1" />
221 </xsl:apply-templates>
224 <xsl:template mode=
"contents" match=
"programlisting">
225 <pre class=
"{@role}"><xsl:apply-templates mode=
"contents" /></pre>
228 <xsl:template mode=
"contents" match=
"userinput">
229 <!-- TODO: Make this bold, but tidy messes it up -->
230 <xsl:apply-templates mode=
"contents" />
233 <xsl:template mode=
"contents" match=
"variablelist">
235 <xsl:apply-templates mode=
"contents" />
239 <xsl:template mode=
"contents" match=
"varlistentry">
241 <xsl:apply-templates mode=
"varlistentry" />
244 <xsl:template mode=
"varlistentry" match=
"term">
245 <p><b><u><xsl:apply-templates mode=
"contents" /></u></b></p>
247 <xsl:template mode=
"varlistentry" match=
"listitem">
248 <xsl:apply-templates mode=
"contents" />
251 <!-- ****************************************************************
253 **************************************************************** -->
255 <xsl:template mode=
"common" match=
"*" priority=
"-1">
256 <xsl:text>UNMANAGED ELEMENT
</xsl:text>
259 <xsl:template mode=
"common" match=
"author">
260 <xsl:text>By
</xsl:text>
261 <xsl:apply-templates select=
"firstname" />
262 <xsl:text> </xsl:text>
263 <xsl:apply-templates select=
"surname" />
264 <xsl:if test=
"affiliation">
265 <xsl:text>,
</xsl:text>
266 <xsl:apply-templates select=
"affiliation/orgname" />
270 <xsl:template mode=
"common" match=
"title">
271 <xsl:apply-templates />
277 vim: syntax=xslt:expandtab:shiftwidth=2:softtabstop=2