2 This is the main stylesheet.
3 Input must have been cleaned up using cleanup.xsl already.
5 This stylesheet does nearly all of the formatting work, but still keeps
6 all data together in one big XML document.
8 A <page> element is produced for each package and symbol.
10 The contents of each <page> will be mostly HTML, with the exception
11 of a few formatting elements like <columns> that are replaced later.
14 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
15 xmlns:macro="http://lichteblau.com/macro"
17 <xsl:output method="xml" indent="yes"/>
19 <xsl:template match="/">
21 <xsl:apply-templates select="documentation"/>
22 <xsl:apply-templates select="documentation/package"/>
23 <xsl:apply-templates select="documentation/package/symbols/*"/>
29 page generation templates
32 <xsl:template match="documentation">
33 <main-page title="@title">
38 <xsl:for-each select="package">
40 <a href="pages/{@id}.html">
42 <xsl:value-of select="@name"/>
45 <div style="left: 100px">
46 <xsl:apply-templates select="documentation-string"/>
51 <h3><a name="index"></a>Symbol Index</h3>
52 <xsl:apply-templates select="package/symbols/*" mode="symbol-index">
53 <xsl:sort select="@name" data-type="text" order="ascending"/>
54 <xsl:with-param name="packagep" select="'pages/'"/>
55 </xsl:apply-templates>
61 <xsl:template match="package">
63 pathname="pages/{@id}.html"
64 title="Package {@name}">
67 <a href="../index.html">
68 <xsl:value-of select="/documentation/@title"/>
73 <xsl:value-of select="@name"/>
75 <xsl:apply-templates select="documentation-string"/>
78 <xsl:if test="sections">
79 <div style="margin-left: -30px">
80 <h3>About This Package</h3>
82 <xsl:apply-templates select="sections/section" mode="toc"/>
84 <xsl:apply-templates select="sections"/>
88 <h3><a name="index"></a>Symbol Index</h3>
89 <xsl:apply-templates select="symbols" mode="symbol-index"/>
95 <xsl:template match="class-definition">
97 pathname="pages/{@id}.html"
98 title="Class {@name}">
101 <a href="{../../@id}.html">
102 <xsl:value-of select="../../@name"/>
106 Class <xsl:value-of select="@name"/>
108 <macro:maybe-columns test="see-also">
109 <h3>Superclasses</h3>
111 <xsl:for-each select="cpl/superclass">
112 <xsl:call-template name="class-list"/>
115 <h3>Documented Subclasses</h3>
118 <xsl:when test="subclasses/subclass">
119 <xsl:for-each select="subclasses/subclass">
120 <xsl:sort select="@id" data-type="text" order="ascending"/>
121 <xsl:call-template name="class-list"/>
129 <xsl:call-template name="main-left"/>
130 </macro:maybe-columns>
134 <xsl:template match="function-definition">
136 pathname="pages/{@id}.html"
137 title="Function {@name}">
140 <a href="{../../@id}.html">
141 <xsl:value-of select="../../@name"/>
146 <xsl:value-of select="@name"/>
148 <macro:maybe-columns test="see-also">
151 <xsl:apply-templates select="lambda-list"/>
153 <xsl:apply-templates select="arguments"/>
154 <xsl:apply-templates select="return"/>
155 <xsl:call-template name="main-left"/>
156 </macro:maybe-columns>
160 <xsl:template match="macro-definition">
162 pathname="pages/{@id}.html"
163 title="Macro {@name}">
166 <a href="{../../@id}.html">
167 <xsl:value-of select="../../@name"/>
172 <xsl:value-of select="@name"/>
174 <xsl:apply-templates select="lambda-list"/>
175 <xsl:call-template name="main"/>
179 <xsl:template match="variable-definition">
181 pathname="pages/{@id}.html"
182 title="Variable {@name}">
185 <a href="{../../@id}.html">
186 <xsl:value-of select="../../@name"/>
191 <xsl:value-of select="@name"/>
193 <xsl:call-template name="main"/>
201 <xsl:template match="*" mode="symbol-index"/>
203 <xsl:template match="symbols" mode="symbol-index">
204 <xsl:param name="packagep"/>
205 <xsl:apply-templates mode="symbol-index">
206 <xsl:sort select="@id" data-type="text" order="ascending"/>
207 <xsl:with-param name="packagep" select="$packagep"/>
208 </xsl:apply-templates>
211 <xsl:template name="undocumented">
212 <xsl:if test="not(documentation-string)">
213 <xsl:text> </xsl:text>
214 <span style="color: red">
220 <xsl:template match="class-definition" mode="symbol-index">
221 <xsl:param name="packagep"/>
222 <a href="{$packagep}{@id}.html">
224 <macro:maybe-package-prefix/>
225 <xsl:value-of select="@name"/>
228 <xsl:text>, class</xsl:text>
229 <xsl:call-template name="undocumented"/>
233 <xsl:template match="function-definition" mode="symbol-index">
234 <xsl:param name="packagep"/>
235 <a href="{$packagep}{@id}.html">
237 <macro:maybe-package-prefix/>
238 <xsl:value-of select="@name"/>
241 <xsl:text>, function</xsl:text>
242 <xsl:call-template name="undocumented"/>
246 <xsl:template match="macro-definition" mode="symbol-index">
247 <xsl:param name="packagep"/>
248 <a href="{$packagep}{@id}.html">
250 <macro:maybe-package-prefix/>
251 <xsl:value-of select="@name"/>
254 <xsl:text>, macro</xsl:text>
255 <xsl:call-template name="undocumented"/>
259 <xsl:template match="variable-definition" mode="symbol-index">
260 <xsl:param name="packagep"/>
261 <a href="{$packagep}{@id}.html">
263 <macro:maybe-package-prefix/>
264 <xsl:value-of select="@name"/>
267 <xsl:text>, variable</xsl:text>
268 <xsl:call-template name="undocumented"/>
277 <xsl:template match="arguments">
281 <xsl:for-each select="arg">
284 <xsl:value-of select="@arg"/>
286 <xsl:text> -- </xsl:text>
287 <xsl:apply-templates/>
294 <xsl:template name="main-left">
296 <xsl:when test="documentation-string">
297 <h3>Details<a name="details"/></h3>
298 <xsl:apply-templates select="documentation-string"/>
301 <p style="color: red; font-weight: bold">
302 No documentation string. Possibly unimplemented or incomplete.
306 <xsl:apply-templates select="implementation-note"/>
309 <xsl:template name="main-right">
310 <xsl:if test="see-also/constructor">
314 <xsl:apply-templates select="see-also/constructor/see"/>
318 <xsl:if test="see-also/slot">
319 <h3>Slot Access Functions</h3>
322 <xsl:apply-templates select="see-also/slot/see"/>
326 <xsl:if test="see-also/other">
330 <xsl:apply-templates select="see-also/other/see"/>
336 <xsl:template name="main">
337 <macro:maybe-columns test="see-also">
338 <xsl:call-template name="main-left"/>
339 </macro:maybe-columns>
342 <xsl:template name="class-list">
343 <xsl:if test="position() != 1">
344 <xsl:text>, </xsl:text>
347 <xsl:when test="@id">
348 <a href="{@id}.html">
350 <xsl:if test="@status = 'INTERNAL'">
351 <xsl:value-of select="@package"/>
352 <xsl:text>::</xsl:text>
354 <xsl:value-of select="@name"/>
358 <xsl:when test="@status = 'INTERNAL'">
359 <tt style="color: #777777">
360 <xsl:value-of select="@package"/>
361 <xsl:text>::</xsl:text>
362 <xsl:value-of select="@name"/>
366 <tt style="color: #777777">
367 <xsl:value-of select="@package"/>
368 <xsl:text>:</xsl:text>
369 <xsl:value-of select="@name"/>
375 <xsl:template match="lambda-list">
376 <tt><xsl:value-of select="../@name"/></tt>
377 <xsl:text> (</xsl:text>
378 <xsl:for-each select="elt">
379 <xsl:if test="position() != 1">
380 <xsl:text> </xsl:text>
382 <b><xsl:value-of select="text()"/></b>
384 <xsl:text>)</xsl:text>
387 <xsl:template mode="about-arguments" match="lambda-list">
389 <a href="{../@id}.html">
391 <xsl:value-of select="../@name"/>
392 <xsl:text> (</xsl:text>
393 <xsl:for-each select="elt">
394 <xsl:if test="position() != 1">
395 <xsl:text> </xsl:text>
397 <xsl:value-of select="text()"/>
399 <xsl:text>)</xsl:text>
404 <xsl:template match="documentation-string">
406 <xsl:apply-templates/>
410 <xsl:template match="short">
411 <xsl:apply-templates/>
414 <xsl:template match="em">
416 <xsl:apply-templates/>
420 <xsl:template match="var">
422 <xsl:apply-templates/>
426 <xsl:template match="code">
428 <xsl:apply-templates/>
432 <xsl:template match="a">
434 <xsl:apply-templates/>
438 <xsl:template match="fun">
439 <a href="{@id}.html">
441 <xsl:apply-templates/>
446 <xsl:template match="class">
447 <a href="{@id}.html">
449 <xsl:apply-templates/>
454 <xsl:template match="variable">
455 <a href="{@id}.html">
457 <xsl:apply-templates/>
462 <xsl:template match="itemize">
464 <xsl:apply-templates/>
468 <xsl:template match="item">
470 <xsl:apply-templates/>
474 <xsl:template match="see">
477 <a href="{@id}.html">
479 <xsl:apply-templates/>
485     
487 <xsl:value-of select="@see"/>
494 <xsl:template match="return">
495 <h3>Return Value</h3>
497 <xsl:apply-templates/>
501 <xsl:template match="implementation-note">
502 <h3>Implementation notes</h3>
503 <xsl:apply-templates/>
506 <xsl:template match="break">
510 <xsl:template match="sections">
511 <xsl:for-each select="section">
513 <a name="{generate-id()}"/>
514 <xsl:value-of select="@section"/>
516 <xsl:apply-templates/>
520 <xsl:template match="section" mode="toc">
521 <a href="#{generate-id()}" style="font-weight: bold">
522 <xsl:value-of select="@section"/>
527 <xsl:template match="aboutfun">
528 <xsl:variable name="fun" select="text()"/>
530 mode="about-arguments"
531 select="//function-definition[@name=$fun]/lambda-list"/>
532 <div style="margin-left: 3em">
535 test="//function-definition[@name=$fun]/documentation-string//short">
536 <xsl:for-each select="//function-definition[@name=$fun]">
537 <xsl:apply-templates select="documentation-string//short"/>
538 <xsl:text> </xsl:text>
539 <a href="{@id}.html#details">...</a>
544 select="//function-definition[@name=$fun]/documentation-string"/>
551 <xsl:template match="aboutclass">
552 <xsl:variable name="name" select="text()"/>
553 <xsl:for-each select="//class-definition[@name=$name]">
555 <a href="{@id}.html">
557 <xsl:value-of select="@name"/>
561 <div style="margin-left: 3em">
564 test="//class-definition[@name=$name]/documentation-string//short">
565 <xsl:for-each select="//class-definition[@name=$name]">
566 <xsl:apply-templates select="documentation-string//short"/>
567 <xsl:text> </xsl:text>
568 <a href="{@id}.html#details">...</a>
573 select="//class-definition[@name=$name]/documentation-string"/>