Debian Codegraph @

stylesheets/defguide.xsl

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 <?xml version="1.0"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:scvs="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.CVS"
4 xmlns:xcvs="com.nwalsh.xalan.CVS"
5 exclude-result-prefixes="scvs xcvs"
6 version="1.0">
7
•8 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/autoidx.xsl"/>
9 <xsl:include href="html-titlepage.xsl"/>
10
11 <xsl:param name="output.media" select="'online'"/>
12 <xsl:param name="output.type" select="'expanded'"/>
13 <xsl:param name="html.stylesheet">defguide.css</xsl:param>
14 <xsl:param name="toc.section.depth" select="1"/>
15 <xsl:param name="section.autolabel" select="1"/>
16 <xsl:param name="section.label.includes.component.label" select="1"/>
17
18 <xsl:param name="admon.graphics.path" select="'figures/100dpi/admon/'"/>
19 <xsl:param name="callout.graphics.path" select="'figures/100dpi/callouts/'"/>
20
21 <xsl:template match="processing-instruction('lb')">
22 <br/>
23 </xsl:template>
24
25 <xsl:template name="user.header.content">
26 <xsl:param name="node" select="."/>
27
28 <xsl:if test="$node != /book/colophon">
29 <p class="alpha-version">
30 <xsl:text>This is an </xsl:text>
31 <a href="co01.html">
32 <em>alpha</em>
33 <xsl:text> version</xsl:text>
34 </a>
35 <xsl:text> of this book.</xsl:text>
36 </p>
37 </xsl:if>
38 </xsl:template>
39
40 <xsl:template name="user.footer.navigation">
41 <xsl:param name="node" select="."/>
42 <p>
43 <a href="dbcpyright.html">Copyright</a>
44 <xsl:text> &#xA9; 1999, 2000, 2001 </xsl:text>
45 <a href="http://www.oreilly.com/">O'Reilly &amp; Associates, Inc.</a>
46 </p>
47 </xsl:template>
48
49 <xsl:template name="revision.graphic">
50 <xsl:param name="node" select="."/>
51 <xsl:param name="large" select="'0'"/>
52
53 <xsl:if test="$node/@revision">
54 <xsl:choose>
55 <xsl:when test="$node/@revision='5.0'">
56 <img src="figures/rev_5.0.png" alt="[5.0]" align="absbottom"/>
57 </xsl:when>
58 <xsl:when test="$node/@revision='4.0'">
59 <img src="figures/rev_4.0.png" alt="[4.0]" align="absbottom"/>
60 </xsl:when>
61 <xsl:when test="$node/@revision='3.1'">
62 <!-- nop; 3.1 isn't interesting anymore -->
63 </xsl:when>
64 <xsl:when test="$node/@revision='EBNF'">
65 <img src="figures/rev_ebnf.png" alt="[EBNF]" align="absbottom"/>
66 </xsl:when>
67 <xsl:when test="$node/@revision='SVG'">
68 <img src="figures/rev_svg.png" alt="[SVG]" align="absbottom"/>
69 </xsl:when>
70 <xsl:when test="$node/@revision='MathML'">
71 <img src="figures/rev_mathml.png" alt="[MathML]" align="absbottom"/>
72 </xsl:when>
73 <xsl:when test="$node/@revision='HTMLForms'">
74 <img src="figures/rev_htmlforms.png" alt="[HTML Forms]" align="absbottom"/>
75 </xsl:when>
76 <xsl:otherwise>
77 <xsl:message>
78 <xsl:text>Unexpected revision '</xsl:text>
79 <xsl:value-of select="$node/@revision"/>
80 <xsl:text>' on </xsl:text>
81 <xsl:value-of select="local-name(.)"/>
82 </xsl:message>
83 </xsl:otherwise>
84 </xsl:choose>
85 </xsl:if>
86 </xsl:template>
87
88 <xsl:template match="refentry">
89 <xsl:variable name="refmeta" select=".//refmeta"/>
90 <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
91 <xsl:variable name="refnamediv" select=".//refnamediv"/>
92 <xsl:variable name="refname" select="$refnamediv//refname"/>
93 <xsl:variable name="title">
94 <xsl:choose>
95 <xsl:when test="$refentrytitle">
96 <xsl:apply-templates select="$refentrytitle[1]" mode="title"/>
97 </xsl:when>
98 <xsl:when test="$refname">
99 <xsl:apply-templates select="$refname[1]" mode="title"/>
100 </xsl:when>
101 <xsl:otherwise></xsl:otherwise>
102 </xsl:choose>
103 </xsl:variable>
104
105 <div class="{name(.)}">
106 <h1 class="title">
107 <a>
108 <xsl:attribute name="name">
109 <xsl:call-template name="object.id"/>
110 </xsl:attribute>
111 </a>
112 <xsl:call-template name="revision.graphic">
113 <xsl:with-param name="large" select="'1'"/>
114 </xsl:call-template>
115 <xsl:copy-of select="$title"/>
116 </h1>
117 <xsl:apply-templates/>
118 <xsl:call-template name="process.footnotes"/>
119 </div>
120 </xsl:template>
121
122 <xsl:template match="para">
123 <xsl:if test="not(@condition)
124 or (@condition = $output.media)">
125 <p>
126 <xsl:if test="@id">
127 <a name="{@id}"/>
128 </xsl:if>
129 <xsl:call-template name="revision.graphic"/>
130 <xsl:apply-templates/>
131 </p>
132 </xsl:if>
133 </xsl:template>
134
135 <xsl:template match="phrase">
136 <xsl:if test="not(@condition)
137 or (@condition = $output.media)">
138 <xsl:choose>
139 <xsl:when test="@role = 'common.attributes'
140 and count(id('common.attributes')) &gt; 0">
141 <a>
142 <xsl:attribute name="href">
143 <xsl:call-template name="href.target">
144 <xsl:with-param name="object" select="id('common.attributes')"/>
145 </xsl:call-template>
146 </xsl:attribute>
147 <xsl:apply-imports/>
148 </a>
149 </xsl:when>
150 <xsl:otherwise>
151 <xsl:apply-imports/>
152 </xsl:otherwise>
153 </xsl:choose>
154 </xsl:if>
155 </xsl:template>
156
157 <xsl:template match="ulink">
158 <xsl:choose>
159 <xsl:when test="not(@condition)
160 or (@condition = $output.media)">
161 <xsl:apply-imports/>
162 </xsl:when>
163 <xsl:otherwise>
164 <xsl:apply-templates/>
165 </xsl:otherwise>
166 </xsl:choose>
167 </xsl:template>
168
169 <xsl:template match="anchor[@role='HACK-ex.out.start']">
170 <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
171 <xsl:text>div class="example-output"</xsl:text>
172 <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
173 </xsl:template>
174
175 <xsl:template match="anchor[@role='HACK-ex.out.end']">
176 <xsl:text disable-output-escaping="yes">&lt;/div&gt;</xsl:text>
177 </xsl:template>
178
179 <xsl:template match="title" mode="book.titlepage.recto.mode">
180 <h1>
181 <xsl:apply-templates/>
182 <xsl:apply-templates select="../subtitle[1]"
183 mode="book.titlepage.recto.mode"/>
184 </h1>
185 </xsl:template>
186
187 <xsl:template match="subtitle" mode="book.titlepage.recto.mode">
188 <xsl:text>: </xsl:text>
189 <xsl:apply-templates/>
190 </xsl:template>
191
192 <!-- ============================================================ -->
193
194 <xsl:template match="informaltable">
195 <xsl:choose>
196 <xsl:when test="@role='elemsynop'">
197 <xsl:apply-templates select=".//row" mode="elemsynop"/>
198 </xsl:when>
199 <xsl:otherwise>
200 <xsl:apply-imports/>
201 </xsl:otherwise>
202 </xsl:choose>
203 </xsl:template>
204
205 <xsl:template match="row" mode="elemsynop">
206 <xsl:variable name="entry" select="entry[1]"/>
207 <xsl:variable name="entry2" select="entry[2]"/>
208
209 <xsl:choose>
210 <xsl:when test="@role = 'cmtitle'">
211 <h3>
212 <xsl:apply-templates select="$entry/*"/>
213 </h3>
214 </xsl:when>
215 <xsl:when test="@role = 'cmsynop'">
216 <xsl:apply-templates select="$entry/*"/>
217 </xsl:when>
218 <xsl:when test="@role = 'incltitle'">
219 <h3>
220 <xsl:apply-templates select="$entry/*"/>
221 </h3>
222 </xsl:when>
223 <xsl:when test="@role = 'inclsynop'">
224 <xsl:apply-templates select="$entry/*"/>
225 </xsl:when>
226 <xsl:when test="@role = 'excltitle'">
227 <h3>
228 <xsl:apply-templates select="$entry/*"/>
229 </h3>
230 </xsl:when>
231 <xsl:when test="@role = 'exclsynop'">
232 <xsl:apply-templates select="$entry/*"/>
233 </xsl:when>
234 <xsl:when test="@role = 'attrtitle'">
235 <h3>
236 <xsl:apply-templates select="$entry/*"/>
237 </h3>
238 <p>
239 <xsl:apply-templates select="$entry2/*"/>
240 </p>
241 </xsl:when>
242 <xsl:when test="@role = 'attrheader'">
243 <xsl:variable name="attrrows" select="../row[@role='attr']"/>
244 <table border="1" width="100%" summary="Attributes">
245 <tr>
246 <xsl:apply-templates/>
247 </tr>
248 <xsl:for-each select="$attrrows">
249 <tr>
250 <xsl:apply-templates/>
251 </tr>
252 </xsl:for-each>
253 </table>
254 </xsl:when>
255 <xsl:when test="@role = 'attr'">
256 <!-- nop -->
257 </xsl:when>
258 <xsl:when test="@role = 'tmtitle'">
259 <h3>
260 <xsl:apply-templates select="$entry/*"/>
261 </h3>
262 </xsl:when>
263 <xsl:when test="@role = 'tmsynop'">
264 <xsl:apply-templates select="$entry/*"/>
265 </xsl:when>
266 <xsl:when test="@role = 'petitle'">
267 <xsl:variable name="attrrows" select="../row[@role='pe']"/>
268 <h3>
269 <xsl:apply-templates select="$entry/*"/>
270 </h3>
271
272 <p>
273 <xsl:text>The following parameter entities contain </xsl:text>
274 <xsl:value-of select="ancestor::refentry/refnamediv/refname"/>
275 <xsl:text>:</xsl:text>
276 </p>
277
278 <table border="1" width="100%" summary="Attributes">
279 <tr>
280 <xsl:apply-templates/>
281 </tr>
282 <xsl:for-each select="$attrrows">
283 <tr>
284 <xsl:apply-templates/>
285 </tr>
286 </xsl:for-each>
287 </table>
288 </xsl:when>
289 <xsl:when test="@role = 'pe'">
290 <!-- nop -->
291 </xsl:when>
292 <xsl:when test="@role = 'vle-pe'">
293 <!-- nop -->
294 </xsl:when>
295 <xsl:when test="@role = 'vle-el'">
296 <!-- nop -->
297 </xsl:when>
298 <xsl:when test="@role = 'vle-iel'">
299 <!-- nop -->
300 </xsl:when>
301 <xsl:when test="@role = 'vle-petitle'">
302 <xsl:variable name="attrrows" select="../row[@role='vle-pe']"/>
303 <p>
304 <b><xsl:apply-templates select="$entry/*"/></b>
305 </p>
306 <table border="0" width="100%" summary="Attributes">
307 <xsl:for-each select="$attrrows">
308 <tr>
309 <xsl:apply-templates/>
310 </tr>
311 </xsl:for-each>
312 </table>
313 </xsl:when>
314 <xsl:when test="@role = 'vle-eltitle'">
315 <xsl:variable name="attrrows" select="../row[@role='vle-el']"/>
316 <p>
317 <b><xsl:apply-templates select="$entry/*"/></b>
318 </p>
319 <table border="0" width="100%" summary="Attributes">
320 <xsl:for-each select="$attrrows">
321 <tr>
322 <xsl:apply-templates/>
323 </tr>
324 </xsl:for-each>
325 </table>
326 </xsl:when>
327 <xsl:when test="@role = 'vle-ieltitle'">
328 <xsl:variable name="attrrows" select="../row[@role='vle-iel']"/>
329 <p>
330 <b><xsl:apply-templates select="$entry/*"/></b>
331 </p>
332 <table border="0" width="100%" summary="Attributes">
333 <xsl:for-each select="$attrrows">
334 <tr>
335 <xsl:apply-templates/>
336 </tr>
337 </xsl:for-each>
338 </table>
339 </xsl:when>
340 <xsl:when test="@role = 'vle-cmtitle'">
341 <p>
342 <b>Parameter entity content:</b>
343 </p>
344 </xsl:when>
345 </xsl:choose>
346 </xsl:template>
347
348 <!-- ============================================================ -->
349
350 <xsl:template name="titlepage-block">
351 <xsl:variable name="authorgroup" select="bookinfo/authorgroup[1]"/>
352 <xsl:variable name="isbn" select="bookinfo/isbn[1]"/>
353 <xsl:variable name="version" select="bookinfo/releaseinfo[1]"/>
354 <xsl:variable name="date" select="bookinfo/pubdate[1]"/>
355 <xsl:variable name="legalnotice" select="bookinfo/legalnotice[1]"/>
356 <xsl:variable name="copyright" select="bookinfo/copyright[1]"/>
357
358 <p class="titlepage-block">
359 <span class="authorgroup">
360 <xsl:call-template name="gentext">
361 <xsl:with-param name="key">by</xsl:with-param>
362 </xsl:call-template>
363 <xsl:text>&#160;</xsl:text>
364 <xsl:apply-templates select="$authorgroup/author" mode="titleblock"/>
365 </span>
366 <br/>
367 <span class="contributors">
368 <xsl:text>With contributions from</xsl:text>
369 <xsl:text>&#160;</xsl:text>
370 <xsl:apply-templates select="$authorgroup/othercredit" mode="titleblock"/>
371 </span>
372 <br/>
373 <span class="isbn">
374 <xsl:text>ISBN: </xsl:text>
375 <a href="http://www.oreilly.com/catalog/docbook">
376 <xsl:apply-templates select="$isbn/node()"/>
377 </a>
378 </span>
379 <br/>
380 <span class="version">
381 <xsl:apply-templates select="$version/node()"/>
382 </span>
383 <br/>
384 <span class="date">
385 <!-- rcsdate = "$Date$" -->
386 <!-- timeString = "dow mon dd hh:mm:ss TZN yyyy" -->
387
388 <xsl:text>Updated: </xsl:text>
389
390 <xsl:choose>
391 <xsl:when test="function-available('scvs:localTime')">
392 <xsl:variable name="sTimeString"
393 select="scvs:localTime($date/text())"/>
394 <xsl:value-of select="substring($sTimeString, 1, 3)"/>
395 <xsl:text>, </xsl:text>
396 <xsl:value-of select="substring($sTimeString, 9, 2)"/>
397 <xsl:text> </xsl:text>
398 <xsl:value-of select="substring($sTimeString, 5, 3)"/>
399 <xsl:text> </xsl:text>
400 <xsl:value-of select="substring($sTimeString, 25, 4)"/>
401 </xsl:when>
402 <xsl:when test="function-available('xcvs:localTime')">
403 <xsl:variable name="xTimeString"
404 select="xcvs:localTime($date/text())"/>
405 <xsl:value-of select="substring($xTimeString, 1, 3)"/>
406 <xsl:text>, </xsl:text>
407 <xsl:value-of select="substring($xTimeString, 9, 2)"/>
408 <xsl:text> </xsl:text>
409 <xsl:value-of select="substring($xTimeString, 5, 3)"/>
410 <xsl:text> </xsl:text>
411 <xsl:value-of select="substring($xTimeString, 25, 4)"/>
412 </xsl:when>
413 <xsl:otherwise>
414 <xsl:value-of select="$date/text()"/>
415 </xsl:otherwise>
416 </xsl:choose>
417 </span>
418 </p>
419 <xsl:apply-templates select="$copyright" mode="titlepage.mode"/>
420 </xsl:template>
421
422 <xsl:template match="authorgroup/author" mode="titleblock">
423 <xsl:if test="position() &gt; 1 and last() &gt; 2">, </xsl:if>
424 <xsl:if test="position() &gt; 1 and position() = last()"> and </xsl:if>
425 <xsl:apply-templates select="."/>
426 </xsl:template>
427
428 <xsl:template match="authorgroup/othercredit" mode="titleblock">
429 <xsl:if test="position() &gt; 1 and last() &gt; 2">, </xsl:if>
430 <xsl:if test="position() &gt; 1 and position() = last()"> and </xsl:if>
431 <xsl:apply-templates select="."/>
432 <xsl:if test="contrib">
433 <xsl:text> (</xsl:text>
434 <xsl:apply-templates select="contrib" mode="titleblock"/>
435 <xsl:text>)</xsl:text>
436 </xsl:if>
437 </xsl:template>
438
439 <xsl:template match="othercredit/contrib" mode="titleblock">
440 <xsl:apply-templates/>
441 </xsl:template>
442
443 <xsl:template match="copyright" mode="titlepage.mode">
444 <br clear="all"/>
445 <xsl:apply-templates select="../legalnotice" mode="titlepage.mode"/>
446 </xsl:template>
447
448 <!-- ============================================================ -->
449
450 <xsl:template match="refentry" mode="toc">
451 <xsl:variable name="refmeta" select=".//refmeta"/>
452 <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
453 <xsl:variable name="refnamediv" select=".//refnamediv"/>
454 <xsl:variable name="refname" select="$refnamediv//refname"/>
455 <xsl:variable name="title">
456 <xsl:choose>
457 <xsl:when test="$refentrytitle">
458 <xsl:apply-templates select="$refentrytitle[1]" mode="title"/>
459 </xsl:when>
460 <xsl:when test="$refname">
461 <xsl:apply-templates select="$refname[1]" mode="title"/>
462 </xsl:when>
463 <xsl:otherwise></xsl:otherwise>
464 </xsl:choose>
465 </xsl:variable>
466
467 <xsl:element name="{$toc.listitem.type}">
468 <a>
469 <xsl:attribute name="href">
470 <xsl:call-template name="href.target"/>
471 </xsl:attribute>
472 <xsl:copy-of select="$title"/>
473 </a>
474 <xsl:call-template name="revision.graphic">
475 <xsl:with-param name="large" select="'1'"/>
476 </xsl:call-template>
477 <xsl:if test="annotate.toc != 0">
478 <xsl:text> - </xsl:text>
479 <xsl:value-of select="refnamediv/refpurpose"/>
480 </xsl:if>
481 </xsl:element>
482 </xsl:template>
483
484 <!-- ============================================================ -->
485
486 <xsl:template match="sgmltag">
487 <xsl:variable name="class">
488 <xsl:choose>
489 <xsl:when test="@class">
490 <xsl:value-of select="@class"/>
491 </xsl:when>
492 <xsl:otherwise>element</xsl:otherwise>
493 </xsl:choose>
494 </xsl:variable>
495
496 <xsl:variable name="uc" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
497 <xsl:variable name="lc" select="'abcdefghijklmnopqrstuvwxyz'"/>
498
499 <xsl:variable name="name" select="translate(.,$uc,$lc)"/>
500
501 <!--
502 <xsl:message>
503 <xsl:value-of select="$class"/>
504 <xsl:text>: </xsl:text>
505 <xsl:value-of select="$name"/>
506 <xsl:text>: </xsl:text>
507 <xsl:value-of select="concat($name,'.element')"/>
508 <xsl:text>: </xsl:text>
509 <xsl:value-of select="count(id(concat($name,'.element')))"/>
510 </xsl:message>
511 -->
512
513 <xsl:choose>
514 <xsl:when test="$class = 'element'
515 and count(id(concat($name,'.element'))) &gt; 0">
516 <xsl:variable name="targets" select="id(concat($name,'.element'))"/>
517 <xsl:variable name="target" select="$targets[1]"/>
518 <a>
519 <xsl:attribute name="href">
520 <xsl:call-template name="href.target">
521 <xsl:with-param name="object" select="$target"/>
522 </xsl:call-template>
523 </xsl:attribute>
524 <xsl:apply-imports/>
525 </a>
526 </xsl:when>
527 <xsl:when test="$class = 'paramentity'
528 and count(id(concat($name,'.parament'))) &gt; 0">
529 <xsl:variable name="targets" select="id(concat($name,'.parament'))"/>
530 <xsl:variable name="target" select="$targets[1]"/>
531 <a>
532 <xsl:attribute name="href">
533 <xsl:call-template name="href.target">
534 <xsl:with-param name="object" select="$target"/>
535 </xsl:call-template>
536 </xsl:attribute>
537 <xsl:apply-imports/>
538 </a>
539 </xsl:when>
540 <xsl:otherwise>
541 <xsl:apply-imports/>
542 </xsl:otherwise>
543 </xsl:choose>
544 </xsl:template>
545
546 <!-- ============================================================ -->
547
548 <xsl:template match="refsect2/title">
549 <h3>
550 <xsl:if test="parent::refsect2/@role = 'fu'">
551 <xsl:call-template name="revision.graphic">
552 <xsl:with-param name="node" select="parent::refsect2"/>
553 </xsl:call-template>
554 <xsl:text> </xsl:text>
555 </xsl:if>
556 <xsl:apply-templates/>
557 </h3>
558 </xsl:template>
559
560 <!-- ============================================================ -->
561
562 </xsl:stylesheet>