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}">
41 <xsl:for-each select=
"package">
42 <xsl:variable name=
"url"
43 select=
"concat('pages/', @id, '.html')"/>
47 <xsl:value-of select=
"@name"/>
50 <div style=
"left: 100px">
51 <xsl:apply-templates select=
"documentation-string"/>
53 <xsl:if test=
"sections">
54 <p><i>About this package:
</i></p>
56 <xsl:for-each select=
"sections/section">
58 <a href=
"{$url}#{generate-id()}">
59 <xsl:value-of select=
"@section"/>
71 <h3><a name=
"index"></a>Symbol Index
</h3>
73 <xsl:apply-templates select=
"package/symbols/*"
75 <xsl:sort select=
"@name" data-type=
"text" order=
"ascending"/>
76 <xsl:with-param name=
"packagep" select=
"'pages/'"/>
77 </xsl:apply-templates>
84 <xsl:template match=
"package">
86 pathname=
"pages/{@id}.html"
87 title=
"Package {@name}">
91 <a href=
"../index.html">
92 <xsl:value-of select=
"/documentation/@title"/>
97 <xsl:value-of select=
"@name"/>
99 <xsl:apply-templates select=
"documentation-string"/>
104 <xsl:if test=
"sections">
105 <div style=
"margin-left: -30px">
106 <h3>About This Package
</h3>
108 <xsl:for-each select=
"sections/section">
109 <a href=
"#{generate-id()}" style=
"font-weight: bold">
110 <xsl:value-of select=
"@section"/>
115 <xsl:apply-templates select=
"sections"/>
120 <h3><a name=
"index"></a>Symbol Index
</h3>
121 <xsl:apply-templates select=
"symbols" mode=
"symbol-index"/>
127 <xsl:template match=
"class-definition">
129 pathname=
"pages/{@id}.html"
130 title=
"Class {@name}">
134 <a href=
"{../../@id}.html">
135 <xsl:value-of select=
"../../@name"/>
139 Class
<xsl:value-of select=
"@name"/>
144 or //class-definition[@id=current()//superclass/@id]
147 <h3>Superclasses
</h3>
149 <xsl:for-each select=
"cpl/superclass">
150 <xsl:call-template name=
"class-list"/>
153 <h3>Documented Subclasses
</h3>
156 <xsl:when test=
"subclasses/subclass">
157 <xsl:for-each select=
"subclasses/subclass">
158 <xsl:sort select=
"@id" data-type=
"text" order=
"ascending"/>
159 <xsl:call-template name=
"class-list"/>
167 <xsl:call-template name=
"main-left"/>
169 </macro:maybe-columns>
173 <xsl:template match=
"function-definition">
175 pathname=
"pages/{@id}.html"
176 title=
"Function {@name}">
180 <a href=
"{../../@id}.html">
181 <xsl:value-of select=
"../../@name"/>
186 <xsl:value-of select=
"@name"/>
189 <macro:maybe-columns test=
"see-also">
193 <xsl:apply-templates select=
"lambda-list"/>
195 <xsl:apply-templates select=
"arguments"/>
196 <xsl:apply-templates select=
"return"/>
197 <xsl:call-template name=
"main-left"/>
199 </macro:maybe-columns>
203 <xsl:template match=
"macro-definition">
205 pathname=
"pages/{@id}.html"
206 title=
"Macro {@name}">
210 <a href=
"{../../@id}.html">
211 <xsl:value-of select=
"../../@name"/>
216 <xsl:value-of select=
"@name"/>
218 <xsl:apply-templates select=
"lambda-list"/>
219 <xsl:call-template name=
"main"/>
224 <xsl:template match=
"variable-definition">
226 pathname=
"pages/{@id}.html"
227 title=
"Variable {@name}">
231 <a href=
"{../../@id}.html">
232 <xsl:value-of select=
"../../@name"/>
237 <xsl:value-of select=
"@name"/>
239 <xsl:call-template name=
"main"/>
248 <xsl:template match=
"*" mode=
"symbol-index"/>
250 <xsl:template match=
"symbols" mode=
"symbol-index">
251 <xsl:param name=
"packagep"/>
253 <xsl:apply-templates mode=
"symbol-index">
254 <xsl:sort select=
"@id" data-type=
"text" order=
"ascending"/>
255 <xsl:with-param name=
"packagep" select=
"$packagep"/>
256 </xsl:apply-templates>
260 <xsl:template name=
"index-entry">
261 <xsl:param name=
"packagep"/>
262 <xsl:param name=
"kind"/>
265 <xsl:if test=
"$packagep">
267 <span class=
"nonlink">
269 <span style=
"color: #777777">
270 <xsl:value-of select=
"../../@name"/>
271 <xsl:text>:
</xsl:text>
278 <a href=
"{$packagep}{@id}.html">
280 <xsl:value-of select=
"@name"/>
283 <xsl:text>,
</xsl:text>
284 <xsl:value-of select=
"$kind"/>
285 <xsl:call-template name=
"undocumented"/>
290 <xsl:template match=
"class-definition" mode=
"symbol-index">
291 <xsl:param name=
"packagep"/>
292 <xsl:call-template name=
"index-entry">
293 <xsl:with-param name=
"packagep" select=
"$packagep"/>
294 <xsl:with-param name=
"kind" select=
"'class'"/>
298 <xsl:template match=
"function-definition" mode=
"symbol-index">
299 <xsl:param name=
"packagep"/>
300 <xsl:call-template name=
"index-entry">
301 <xsl:with-param name=
"packagep" select=
"$packagep"/>
302 <xsl:with-param name=
"kind" select=
"'function'"/>
306 <xsl:template match=
"macro-definition" mode=
"symbol-index">
307 <xsl:param name=
"packagep"/>
308 <xsl:call-template name=
"index-entry">
309 <xsl:with-param name=
"packagep" select=
"$packagep"/>
310 <xsl:with-param name=
"kind" select=
"'macro'"/>
314 <xsl:template match=
"variable-definition" mode=
"symbol-index">
315 <xsl:param name=
"packagep"/>
316 <xsl:call-template name=
"index-entry">
317 <xsl:with-param name=
"packagep" select=
"$packagep"/>
318 <xsl:with-param name=
"kind" select=
"'variable'"/>
327 <xsl:template match=
"arguments">
331 <xsl:for-each select=
"arg">
334 <xsl:value-of select=
"@arg"/>
336 <xsl:text> --
</xsl:text>
337 <xsl:apply-templates/>
344 <xsl:template name=
"main-left">
346 <xsl:when test=
"documentation-string">
347 <h3>Details
<a name=
"details"/></h3>
348 <xsl:apply-templates select=
"documentation-string"/>
351 <p style=
"color: red; font-weight: bold">
352 No documentation string. Possibly unimplemented or incomplete.
356 <xsl:apply-templates select=
"implementation-note"/>
359 <xsl:template name=
"main-right">
360 <xsl:if test=
"see-also/constructor">
364 <xsl:apply-templates select=
"see-also/constructor/see"/>
368 <xsl:if test=
"see-also/slot">
369 <h3>Slot Access Functions
</h3>
372 <xsl:apply-templates select=
"see-also/slot/see"/>
377 test=
"//class-definition[@id=current()//superclass/@id]
380 <h3>Inherited Slot Access Functions
</h3>
384 select=
"//class-definition[@id=current()//superclass/@id]
385 //see-also/slot/see"/>
389 <xsl:if test=
"see-also/other|see-also/auto">
393 <xsl:for-each select=
"see-also/other/see|see-also/auto/see">
394 <xsl:variable name=
"name" select=
"text()"/>
395 <xsl:if test=
"not(preceding-sibling::see[text() = $name])">
396 <xsl:apply-templates select=
"."/>
404 <xsl:template name=
"main">
405 <macro:maybe-columns test=
"see-also">
406 <xsl:call-template name=
"main-left"/>
407 </macro:maybe-columns>
410 <xsl:template name=
"class-list">
411 <xsl:if test=
"position() != 1">
412 <xsl:text>,
</xsl:text>
415 <xsl:when test=
"@id">
416 <a href=
"{@id}.html">
418 <xsl:if test=
"@status = 'INTERNAL'">
419 <xsl:value-of select=
"@package"/>
420 <xsl:text>::
</xsl:text>
422 <xsl:value-of select=
"@name"/>
426 <xsl:when test=
"@status = 'INTERNAL'">
427 <tt style=
"color: #777777">
428 <xsl:value-of select=
"@package"/>
429 <xsl:text>::
</xsl:text>
430 <xsl:value-of select=
"@name"/>
434 <tt style=
"color: #777777">
435 <xsl:value-of select=
"@package"/>
436 <xsl:text>:
</xsl:text>
437 <xsl:value-of select=
"@name"/>
443 <xsl:template match=
"lambda-list">
444 <tt><xsl:value-of select=
"../@name"/></tt>
445 <xsl:text> (
</xsl:text>
446 <xsl:for-each select=
"elt">
447 <xsl:if test=
"position() != 1">
448 <xsl:text> </xsl:text>
450 <b><xsl:value-of select=
"text()"/></b>
452 <xsl:text>)
</xsl:text>
455 <xsl:template mode=
"about-arguments" match=
"lambda-list">
457 <a href=
"{../@id}.html">
459 <xsl:value-of select=
"../@name"/>
460 <xsl:text> (
</xsl:text>
461 <xsl:for-each select=
"elt">
462 <xsl:if test=
"position() != 1">
463 <xsl:text> </xsl:text>
465 <xsl:value-of select=
"text()"/>
467 <xsl:text>)
</xsl:text>
472 <xsl:template match=
"documentation-string">
474 <xsl:apply-templates/>
478 <xsl:template match=
"short">
479 <xsl:apply-templates/>
482 <xsl:template match=
"em">
484 <xsl:apply-templates/>
488 <xsl:template match=
"b">
490 <xsl:apply-templates/>
494 <xsl:template match=
"var">
496 <xsl:apply-templates/>
500 <xsl:template match=
"code">
502 <xsl:apply-templates/>
506 <xsl:template match=
"pre">
508 <xsl:apply-templates/>
512 <xsl:template match=
"a">
514 <xsl:apply-templates/>
518 <xsl:template match=
"fun">
519 <a href=
"{@id}.html">
521 <xsl:apply-templates/>
526 <xsl:template match=
"class">
527 <a href=
"{@id}.html">
529 <xsl:apply-templates/>
534 <xsl:template match=
"variable">
535 <a href=
"{@id}.html">
537 <xsl:apply-templates/>
542 <xsl:template match=
"itemize">
544 <xsl:apply-templates/>
548 <xsl:template match=
"item">
550 <xsl:apply-templates/>
554 <xsl:template match=
"see">
557 <a href=
"{@id}.html">
559 <xsl:apply-templates/>
565     
567 <xsl:value-of select=
"@see"/>
574 <xsl:template match=
"return">
575 <h3>Return Value
</h3>
577 <xsl:apply-templates/>
581 <xsl:template match=
"implementation-note">
582 <h3>Implementation notes
</h3>
583 <xsl:apply-templates/>
586 <xsl:template match=
"break">
590 <xsl:template match=
"sections">
591 <xsl:for-each select=
"section">
593 <a name=
"{generate-id()}"/>
594 <xsl:value-of select=
"@section"/>
596 <xsl:apply-templates/>
600 <xsl:template match=
"aboutfun">
601 <xsl:variable name=
"fun" select=
"text()"/>
603 mode=
"about-arguments"
604 select=
"//function-definition[@name=$fun]/lambda-list"/>
605 <div style=
"margin-left: 3em">
608 test=
"//function-definition[@name=$fun]/documentation-string//short">
609 <xsl:for-each select=
"//function-definition[@name=$fun]">
610 <xsl:apply-templates select=
"documentation-string//short"/>
611 <xsl:text> </xsl:text>
612 <a href=
"{@id}.html#details">...
</a>
617 select=
"//function-definition[@name=$fun]/documentation-string"/>
624 <xsl:template match=
"aboutclass">
625 <xsl:variable name=
"name" select=
"text()"/>
626 <xsl:for-each select=
"//class-definition[@name=$name]">
628 <a href=
"{@id}.html">
630 <xsl:value-of select=
"@name"/>
634 <div style=
"margin-left: 3em">
637 test=
"//class-definition[@name=$name]/documentation-string//short">
638 <xsl:for-each select=
"//class-definition[@name=$name]">
639 <xsl:apply-templates select=
"documentation-string//short"/>
640 <xsl:text> </xsl:text>
641 <a href=
"{@id}.html#details">...
</a>
646 select=
"//class-definition[@name=$name]/documentation-string"/>
653 <xsl:template name=
"undocumented">
654 <xsl:if test=
"not(documentation-string)">
655 <xsl:text> </xsl:text>
656 <span style=
"color: red">