Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: third_party/docbook-xsl-1.78.0/template/titlepage.xsl

Issue 1394993002: Doing some cleanup. (Closed) Base URL: https://github.com/dart-lang/www.dartlang.org.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/docbook-xsl-1.78.0/template/titlepage.xml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:t="http://nwalsh.com/docbook/xsl/template/1.0"
4 xmlns:param="http://nwalsh.com/docbook/xsl/template/1.0/param"
5 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
6 xmlns:fo="http://www.w3.org/1999/XSL/Format"
7 xmlns:exsl="http://exslt.org/common"
8 exclude-result-prefixes="doc t param exsl"
9 version='1.0'>
10
11 <!-- ********************************************************************
12 $Id: titlepage.xsl 9600 2012-09-11 12:12:09Z kosek $
13 ********************************************************************
14
15 This file is part of the XSL DocBook Stylesheet distribution.
16 See ../README or http://docbook.sf.net/release/xsl/current/ for
17 copyright and other information.
18
19 ******************************************************************** -->
20
21 <!-- ==================================================================== -->
22
23 <!-- Namespace for wrapper elements. Please set it for XHTML. -->
24 <xsl:param name="ns">
25 <!-- Guess correct setting for cases where parameter is not supplied -->
26 <xsl:choose>
27 <xsl:when test="//*[namespace-uri() = 'http://www.w3.org/1999/XSL/Format']"> http://www.w3.org/1999/XSL/Format</xsl:when>
28 <xsl:when test="//*[namespace-uri() = 'http://www.w3.org/1999/xhtml']">http: //www.w3.org/1999/xhtml</xsl:when>
29 </xsl:choose>
30 </xsl:param>
31
32 <xsl:template match="/">
33 <xsl:text>&#x0a;</xsl:text>
34 <xsl:apply-templates/>
35 <xsl:text>&#x0a;</xsl:text>
36 </xsl:template>
37
38 <doc:reference xmlns="" xml:id="template">
39 <?dbhtml dir="template"?>
40 <?dbhtml filename="index.html"?>
41 <info>
42 <title>Titlepage Template Stylesheet Reference</title>
43 <releaseinfo role="meta">
44 $Id: titlepage.xsl 9600 2012-09-11 12:12:09Z kosek $
45 </releaseinfo>
46 </info>
47 <partintro xml:id="intro_partintro">
48 <title>Introduction</title>
49 <para>This is technical reference documentation for the
50 “titlepage” templates in the DocBook XSL Stylesheets.</para>
51 <para>This is not intended to be user documentation. It is
52 provided for developers writing customization layers for the
53 stylesheets.</para>
54 </partintro>
55 </doc:reference>
56
57 <!-- ==================================================================== -->
58
59 <xsl:preserve-space elements="*"/>
60 <xsl:strip-space elements="xsl:* t:*"/>
61
62 <!-- ==================================================================== -->
63
64 <doc:template match="t:templates" xmlns="" id="templates">
65 <refpurpose>Construct a stylesheet for the templates provided</refpurpose>
66
67 <refdescription>
68 <para>The <literal>t:templates</literal> element is the root of a
69 set of templates. This template creates an appropriate
70 <literal>xsl:stylesheet</literal> for the templates.</para>
71
72 <para>If the <literal>t:templates</literal> element has a
73 <literal>base-stylesheet</literal> attribute, an
74 <literal>xsl:import</literal> statement is constructed for it.</para>
75 </refdescription>
76 </doc:template>
77
78 <xsl:template match="t:templates">
79 <xsl:element name="xsl:stylesheet">
80
81 <xsl:for-each select="document('')/xsl:stylesheet/namespace::exsl">
82 <xsl:copy/>
83 </xsl:for-each>
84
85 <xsl:attribute name="version">1.0</xsl:attribute>
86 <xsl:attribute name="exclude-result-prefixes">exsl</xsl:attribute>
87
88 <xsl:text>&#xA;&#xA;</xsl:text>
89 <xsl:comment>
90 <xsl:text> This stylesheet was created by </xsl:text>
91 <xsl:text>template/titlepage.xsl</xsl:text>
92 </xsl:comment>
93
94 <xsl:if test="@t:base-stylesheet">
95 <xsl:text>&#xA;&#xA;</xsl:text>
96 <xsl:element name="xsl:import">
97 <xsl:attribute name="href">
98 <xsl:value-of select="@t:base-stylesheet"/>
99 </xsl:attribute>
100 </xsl:element>
101 </xsl:if>
102
103 <xsl:apply-templates/>
104
105 <xsl:text>&#xA;&#xA;</xsl:text>
106 </xsl:element>
107 </xsl:template>
108
109 <!-- ==================================================================== -->
110
111 <doc:template match="xsl:*" xmlns="" id="star">
112 <refpurpose>Copy xsl: elements straight through</refpurpose>
113
114 <refdescription>
115 <para>This template simply copies the xsl: elements
116 straight through into the result tree.</para>
117 </refdescription>
118 </doc:template>
119
120 <xsl:template match="xsl:*">
121 <xsl:apply-templates select="." mode="copy"/>
122 </xsl:template>
123
124 <!-- ==================================================================== -->
125
126 <doc:template match="t:titlepage" xmlns="" id="titlepage">
127 <refpurpose>Create the templates necessary to construct a title page</refpurpose >
128
129 <refdescription>
130 <para>The <literal>t:titlepage</literal> element creates a set of
131 templates for processing the titlepage for an element. The
132 <quote>root</quote> of this template set is the template named
133 <quote><literal>wrapper.titlepage</literal></quote>. That is the
134 template that should be called to generate the title page.
135 </para>
136
137 <para>The <literal>t:titlepage</literal> element has three attributes:
138
139 <variablelist>
140 <varlistentry><term>element</term>
141 <listitem><para>The name of the source document element for which
142 these templates apply. In other words, to make a title page for the
143 <tag>article</tag> element, set the
144 <tag class="attribute">element</tag> attribute to
145 <quote><literal>article</literal></quote>. This attribute is required.
146 </para></listitem>
147 </varlistentry>
148 <varlistentry><term>wrapper</term>
149 <listitem><para>The entire title page can be wrapped with an element.
150 This attribute identifies that element.
151 </para></listitem>
152 </varlistentry>
153 <varlistentry><term>class</term>
154 <listitem><para>If the <tag class="attribute">class</tag> attribute
155 is set, a <tag class="attribute">class</tag> attribute with this
156 value will be added to the wrapper element that surrounds the entire
157 title page.
158 </para></listitem>
159 </varlistentry>
160 </variablelist>
161 </para>
162
163 <para>Any other attributes are copied through literally to the
164 wrapper element.</para>
165
166 <para>The content of a <literal>t:titlepage</literal> is one or
167 more <literal>t:titlepage-content</literal>,
168 <literal>t:titlepage-separator</literal>, and
169 <literal>t:titlepage-before</literal> elements.</para>
170
171 <para>Each of these elements may be provided for the <quote>recto</quote>
172 and <quote>verso</quote> sides of the title page.</para>
173
174 </refdescription>
175 </doc:template>
176
177 <xsl:template match="t:titlepage">
178 <!-- process the children to make the templates for the content,
179 separator, and before elements -->
180 <xsl:apply-templates/>
181
182 <!-- output the title page template -->
183 <xsl:text>&#xA;&#xA;</xsl:text>
184 <xsl:element name="xsl:template">
185 <xsl:attribute name="name">
186 <xsl:value-of select="@t:element"/>
187 <xsl:text>.titlepage</xsl:text>
188 </xsl:attribute>
189 <xsl:text>&#xA; </xsl:text>
190 <xsl:element name="{@t:wrapper}" namespace="{$ns}">
191 <xsl:apply-templates select="@*" mode="copy.literal.atts"/>
192 <xsl:text>&#xA; </xsl:text>
193 <xsl:element name="xsl:variable">
194 <xsl:attribute name="name">recto.content</xsl:attribute>
195 <xsl:text>&#xA; </xsl:text>
196 <xsl:element name="xsl:call-template">
197 <xsl:attribute name="name">
198 <xsl:value-of select="@t:element"/>
199 <xsl:text>.titlepage.before.recto</xsl:text>
200 </xsl:attribute>
201 </xsl:element>
202 <xsl:text>&#xA; </xsl:text>
203 <xsl:element name="xsl:call-template">
204 <xsl:attribute name="name">
205 <xsl:value-of select="@t:element"/>
206 <xsl:text>.titlepage.recto</xsl:text>
207 </xsl:attribute>
208 </xsl:element>
209 <xsl:text>&#xA; </xsl:text>
210 </xsl:element>
211 <xsl:text>&#xA; </xsl:text>
212 <xsl:element name="xsl:variable">
213 <xsl:attribute name="name">recto.elements.count</xsl:attribute>
214 <xsl:text>&#xA; </xsl:text>
215 <xsl:element name="xsl:choose">
216 <xsl:text>&#xA; </xsl:text>
217 <xsl:element name="xsl:when">
218 <xsl:attribute name="test">function-available('exsl:node-set')</xsl: attribute>
219 <xsl:element name="xsl:value-of">
220 <xsl:attribute name="select">count(exsl:node-set($recto.content)/* )</xsl:attribute>
221 </xsl:element>
222 </xsl:element>
223 <xsl:text>&#xA; </xsl:text>
224 <xsl:element name="xsl:when">
225 <xsl:attribute name="test">contains(system-property('xsl:vendor'), ' Apache Software Foundation')</xsl:attribute>
226 <xsl:text>&#xA; </xsl:text>
227 <xsl:comment>Xalan quirk</xsl:comment>
228 <xsl:element name="xsl:value-of">
229 <xsl:attribute name="select">count(exsl:node-set($recto.content)/* )</xsl:attribute>
230 </xsl:element>
231 </xsl:element>
232 <xsl:text>&#xA; </xsl:text>
233 <xsl:element name="xsl:otherwise">
234 <xsl:text>1</xsl:text>
235 </xsl:element>
236 <xsl:text>&#xA; </xsl:text>
237 </xsl:element>
238 <xsl:text>&#xA; </xsl:text>
239 </xsl:element>
240 <xsl:text>&#xA; </xsl:text>
241 <xsl:element name="xsl:if">
242 <xsl:attribute name="test">(normalize-space($recto.content) != '') or ($ recto.elements.count > 0)</xsl:attribute>
243 <xsl:text>&#xA; </xsl:text>
244 <xsl:element name="{@t:wrapper}" namespace="{$ns}">
245 <xsl:apply-templates select="t:titlepage-content[@t:side='recto']/@*"
246 mode="copy.literal.atts"/>
247 <xsl:element name="xsl:copy-of">
248 <xsl:attribute name="select">$recto.content</xsl:attribute>
249 </xsl:element>
250 </xsl:element>
251 <xsl:text>&#xA; </xsl:text>
252 </xsl:element>
253 <xsl:text>&#xA; </xsl:text>
254 <xsl:element name="xsl:variable">
255 <xsl:attribute name="name">verso.content</xsl:attribute>
256 <xsl:text>&#xA; </xsl:text>
257 <xsl:element name="xsl:call-template">
258 <xsl:attribute name="name">
259 <xsl:value-of select="@t:element"/>
260 <xsl:text>.titlepage.before.verso</xsl:text>
261 </xsl:attribute>
262 </xsl:element>
263 <xsl:text>&#xA; </xsl:text>
264 <xsl:element name="xsl:call-template">
265 <xsl:attribute name="name">
266 <xsl:value-of select="@t:element"/>
267 <xsl:text>.titlepage.verso</xsl:text>
268 </xsl:attribute>
269 </xsl:element>
270 <xsl:text>&#xA; </xsl:text>
271 </xsl:element>
272 <xsl:text>&#xA; </xsl:text>
273 <xsl:element name="xsl:variable">
274 <xsl:attribute name="name">verso.elements.count</xsl:attribute>
275 <xsl:text>&#xA; </xsl:text>
276 <xsl:element name="xsl:choose">
277 <xsl:text>&#xA; </xsl:text>
278 <xsl:element name="xsl:when">
279 <xsl:attribute name="test">function-available('exsl:node-set')</xsl: attribute>
280 <xsl:element name="xsl:value-of">
281 <xsl:attribute name="select">count(exsl:node-set($verso.content)/* )</xsl:attribute>
282 </xsl:element>
283 </xsl:element>
284 <xsl:text>&#xA; </xsl:text>
285 <xsl:element name="xsl:when">
286 <xsl:attribute name="test">contains(system-property('xsl:vendor'), ' Apache Software Foundation')</xsl:attribute>
287 <xsl:text>&#xA; </xsl:text>
288 <xsl:comment>Xalan quirk</xsl:comment>
289 <xsl:element name="xsl:value-of">
290 <xsl:attribute name="select">count(exsl:node-set($verso.content)/* )</xsl:attribute>
291 </xsl:element>
292 </xsl:element>
293 <xsl:text>&#xA; </xsl:text>
294 <xsl:element name="xsl:otherwise">
295 <xsl:text>1</xsl:text>
296 </xsl:element>
297 <xsl:text>&#xA; </xsl:text>
298 </xsl:element>
299 <xsl:text>&#xA; </xsl:text>
300 </xsl:element>
301 <xsl:text>&#xA; </xsl:text>
302 <xsl:element name="xsl:if">
303 <xsl:attribute name="test">(normalize-space($verso.content) != '') or ($ verso.elements.count > 0)</xsl:attribute>
304 <xsl:text>&#xA; </xsl:text>
305 <xsl:element name="{@t:wrapper}" namespace="{$ns}">
306 <xsl:apply-templates select="t:titlepage-content[@t:side='verso']/@*"
307 mode="copy.literal.atts"/>
308 <xsl:element name="xsl:copy-of">
309 <xsl:attribute name="select">$verso.content</xsl:attribute>
310 </xsl:element>
311 </xsl:element>
312 <xsl:text>&#xA; </xsl:text>
313 </xsl:element>
314 <xsl:text>&#xA; </xsl:text>
315 <xsl:element name="xsl:call-template">
316 <xsl:attribute name="name">
317 <xsl:value-of select="@t:element"/>
318 <xsl:text>.titlepage.separator</xsl:text>
319 </xsl:attribute>
320 </xsl:element>
321 <xsl:text>&#xA; </xsl:text>
322 </xsl:element>
323 <xsl:text>&#xA;</xsl:text>
324 </xsl:element>
325
326 <!-- If we're not importing a base stylesheet, output a default rule
327 for the recto- and verso-mode elements. (If we are importing a
328 base stylesheet, don't do this since the *-rules in the stylesheet
329 will totally override the rules that would otherwise be imported.)
330 -->
331
332 <xsl:if test="not(../@t:base-stylesheet)">
333 <!-- output a default rule for the recto-modes elements -->
334 <xsl:text>&#xA;&#xA;</xsl:text>
335 <xsl:element name="xsl:template">
336 <xsl:attribute name="match">*</xsl:attribute>
337 <xsl:attribute name="mode">
338 <xsl:value-of select="@t:element"/>
339 <xsl:text>.titlepage.recto.mode</xsl:text>
340 </xsl:attribute>
341 <xsl:text>&#xA; </xsl:text>
342 <xsl:comment> if an element isn't found in this mode, </xsl:comment>
343 <xsl:text>&#xA; </xsl:text>
344 <xsl:comment> try the generic titlepage.mode </xsl:comment>
345 <xsl:text>&#xA; </xsl:text>
346 <xsl:element name="xsl:apply-templates">
347 <xsl:attribute name="select">.</xsl:attribute>
348 <xsl:attribute name="mode">titlepage.mode</xsl:attribute>
349 </xsl:element>
350 <xsl:text>&#xA;</xsl:text>
351 </xsl:element>
352
353 <!-- output a default rule for the verso-modes elements -->
354 <xsl:text>&#xA;&#xA;</xsl:text>
355 <xsl:element name="xsl:template">
356 <xsl:attribute name="match">*</xsl:attribute>
357 <xsl:attribute name="mode">
358 <xsl:value-of select="@t:element"/>
359 <xsl:text>.titlepage.verso.mode</xsl:text>
360 </xsl:attribute>
361 <xsl:text>&#xA; </xsl:text>
362 <xsl:comment> if an element isn't found in this mode, </xsl:comment>
363 <xsl:text>&#xA; </xsl:text>
364 <xsl:comment> try the generic titlepage.mode </xsl:comment>
365 <xsl:text>&#xA; </xsl:text>
366 <xsl:element name="xsl:apply-templates">
367 <xsl:attribute name="select">.</xsl:attribute>
368 <xsl:attribute name="mode">titlepage.mode</xsl:attribute>
369 </xsl:element>
370 <xsl:text>&#xA;</xsl:text>
371 </xsl:element>
372 </xsl:if>
373
374 <!-- output default templates for each of the elements listed in -->
375 <!-- the titlepage-content. If a template is suppressed or forced -->
376 <!-- to be off, or has already been output, don't output it. -->
377 <xsl:for-each select="t:titlepage-content/*">
378 <xsl:variable name="thisnode" select="."/>
379 <xsl:if test="(not(@t:suppress-template) or @t:suppress-template='0')
380 and (not(@t:force) or @t:force='0')
381 and (not(preceding-sibling::*[name(.)=name($thisnode)]))">
382 <xsl:text>&#xA;&#xA;</xsl:text>
383 <xsl:element name="xsl:template">
384 <xsl:attribute name="match">
385 <xsl:value-of select="name(.)"/>
386 </xsl:attribute>
387 <xsl:attribute name="mode">
388 <xsl:value-of select="../../@t:element"/>
389 <xsl:text>.titlepage.</xsl:text>
390 <xsl:value-of select="../@t:side"/>
391 <xsl:text>.auto.mode</xsl:text>
392 </xsl:attribute>
393 <xsl:text>&#xA;</xsl:text>
394 <xsl:element name="{../../@t:wrapper}" namespace="{$ns}">
395 <xsl:attribute name="xsl:use-attribute-sets">
396 <xsl:value-of select="../../@t:element"/>
397 <xsl:text>.titlepage.</xsl:text>
398 <xsl:value-of select="../@t:side"/>
399 <xsl:text>.style</xsl:text>
400 </xsl:attribute>
401 <xsl:for-each select="@*">
402 <xsl:if test="not(starts-with(namespace-uri(.),
403 'http://nwalsh.com/docbook/xsl/template/1.0'))">
404 <xsl:attribute name="{name(.)}" namespace="{namespace-uri(.)}">
405 <xsl:value-of select="."/>
406 </xsl:attribute>
407 </xsl:if>
408 </xsl:for-each>
409 <xsl:text>&#xA;</xsl:text>
410
411 <xsl:choose>
412 <xsl:when test="@t:named-template">
413 <xsl:element name="xsl:call-template">
414 <xsl:attribute name="name">
415 <xsl:value-of select="@t:named-template"/>
416 </xsl:attribute>
417 <xsl:for-each select="@*">
418 <xsl:if test="namespace-uri(.)='http://nwalsh.com/docbook/xsl/ template/1.0/param'">
419 <xsl:text>&#xA;</xsl:text>
420 <xsl:element name="xsl:with-param">
421 <xsl:attribute name="name">
422 <xsl:value-of select="local-name(.)"/>
423 </xsl:attribute>
424 <xsl:attribute name="select">
425 <xsl:value-of select="."/>
426 </xsl:attribute>
427 </xsl:element>
428 </xsl:if>
429 </xsl:for-each>
430 <xsl:text>&#xA;</xsl:text>
431 </xsl:element>
432 </xsl:when>
433 <xsl:otherwise>
434 <xsl:element name="xsl:apply-templates">
435 <xsl:attribute name="select">.</xsl:attribute>
436 <xsl:attribute name="mode">
437 <xsl:value-of select="../../@t:element"/>
438 <xsl:text>.titlepage.</xsl:text>
439 <xsl:value-of select="../@t:side"/>
440 <xsl:text>.mode</xsl:text>
441 </xsl:attribute>
442 </xsl:element>
443 </xsl:otherwise>
444 </xsl:choose>
445
446 <xsl:text>&#xA;</xsl:text>
447 </xsl:element>
448 <xsl:text>&#xA;</xsl:text>
449 </xsl:element>
450 </xsl:if>
451 </xsl:for-each>
452 </xsl:template>
453
454 <doc:template match="@*" mode="copy.literal.atts" xmlns=""
455 id="attr_star_in_copy.literal.atts">
456 <refpurpose>Copy t:titlepage attributes</refpurpose>
457
458 <refdescription>
459 <para>This template copies all of the <quote>other</quote> attributes
460 from a <literal>t:titlepage</literal> element onto the specified
461 wrapper.</para>
462 </refdescription>
463 </doc:template>
464
465 <xsl:template match="@*" mode="copy.literal.atts">
466 <xsl:if test="not(starts-with(namespace-uri(.),
467 'http://nwalsh.com/docbook/xsl/template/1.0'))">
468 <xsl:attribute name="{name(.)}">
469 <xsl:value-of select="."/>
470 </xsl:attribute>
471 </xsl:if>
472 </xsl:template>
473
474 <!-- ==================================================================== -->
475
476 <doc:template match="t:titlepage-content" id="titlepage-content">
477 <refpurpose>Create templates for the content of one side of a title page</refpur pose>
478
479 <refdescription>
480 <para>The title page content, that is, the elements from the source
481 document that are rendered on the title page, can be controlled independently
482 for the recto and verso sides of the title page.</para>
483
484 <para>The <literal>t:titlepage-content</literal> element has two attributes:
485
486 <variablelist>
487 <varlistentry><term>side</term>
488 <listitem><para>Identifies the side of the page to which this title
489 page content applies. The
490 <tag class="attribute">side</tag> attribute is required and
491 must be set to either
492 <quote><literal>recto</literal></quote> or
493 <quote><literal>verso</literal></quote>. In addition, you must specify
494 exactly one <literal>t:titlepage-content</literal> for each side
495 within each <literal>t:titlepage</literal>.</para>
496 </listitem>
497 </varlistentry>
498 <varlistentry><term>order</term>
499 <listitem><para>Indicates how the order of the elements presented on
500 the title page is determined. If the
501 <tag class="attribute">order</tag> is
502 <quote><literal>document</literal></quote>, the elements are presented
503 in document order. Otherwise (if the
504 <tag class="attribute">order</tag> is
505 <quote><literal>stylesheet</literal></quote>), the elements are presented
506 in the order that they appear in the template (and consequently in
507 the stylesheet).</para>
508 </listitem>
509 </varlistentry>
510 </variablelist>
511 </para>
512
513 <para>The content of a <literal>t:titlepage-content</literal> element is
514 a list of element names. These names should be unqualified. They identify
515 the elements in the source document that should appear on the title page.
516 </para>
517
518 <para>Each element may have a single attribute:
519 <tag class="attribute">predicate</tag>. The value of this
520 attribute is used as a predicate for the expression that matches
521 the element on which it occurs.</para>
522
523 <para>In other words, to put only the first three authors on the
524 recto-side of a title
525 page, you could specify:
526
527 <screen><![CDATA[
528 <t:titlepage-contents side="recto">
529 <!-- other titlepage elements -->
530 <author predicate="[count(previous-sibling::author)<2]"/>
531 <!-- other titlepage elements -->
532 </t:titlepage-contents>
533 ]]></screen>
534 </para>
535
536 <para>Usually, the elements so named are empty. But it is possible to
537 make one level of selection within them. Suppose that you want to
538 process <literal>authorgroup</literal> elements on the title page, but
539 you want to select only proper authors, editors, or corporate authors,
540 not collaborators or other credited authors.</para>
541
542 <para>In that case, you can put a <literal>t:or</literal> group inside
543 the <literal>authorgroup</literal> element:
544
545 <screen><![CDATA[
546 <t:titlepage-contents side="recto">
547 <!-- other titlepage elements -->
548 <authorgroup>
549 <t:or>
550 <author/>
551 <editor/>
552 <corpauthor/>
553 </t:or>
554 </authorgroup>
555 <!-- other titlepage elements -->
556 </t:titlepage-contents>
557 ]]></screen>
558 </para>
559
560 <para>This will have the effect of automatically generating a template
561 for processing <literal>authorgroup</literal>s in the title page mode,
562 selecting only the specified children. If you need more complex processing,
563 you'll have to construct the templates by hand.</para>
564
565 </refdescription>
566 </doc:template>
567
568 <xsl:template match="t:titlepage-content">
569 <xsl:variable name="side">
570 <xsl:choose>
571 <xsl:when test="@t:side='recto' or @t:side='verso'">
572 <xsl:value-of select="@t:side"/>
573 </xsl:when>
574 <xsl:when test="@t:side">
575 <xsl:message terminate="yes">
576 <xsl:text>Illegal value specified for @t:side </xsl:text>
577 <xsl:text>on t:titlepage-content: </xsl:text>
578 <xsl:value-of select="@t:side"/>
579 </xsl:message>
580 </xsl:when>
581 <xsl:otherwise>
582 <xsl:message terminate="yes">
583 <xsl:text>The @t:side attribute is required on </xsl:text>
584 <xsl:text>t:titlepage-content.</xsl:text>
585 </xsl:message>
586 </xsl:otherwise>
587 </xsl:choose>
588 </xsl:variable>
589
590 <xsl:variable name="mode">
591 <xsl:value-of select="../@t:element"/>
592 <xsl:text>.titlepage.</xsl:text>
593 <xsl:value-of select="$side"/>
594 <xsl:text>.auto.mode</xsl:text>
595 </xsl:variable>
596
597 <xsl:text>&#xA;&#xA;</xsl:text>
598 <xsl:element name="xsl:template">
599 <xsl:attribute name="name">
600 <xsl:value-of select="../@t:element"/>
601 <xsl:text>.titlepage.</xsl:text>
602 <xsl:value-of select="$side"/>
603 </xsl:attribute>
604
605 <xsl:choose>
606 <!-- if document order is selected, make a huge select statement
607 on a single xsl:apply-templates to pick out the right elements
608 for the title page. -->
609 <xsl:when test="@t:order='document'">
610 <xsl:if test="count(child::*)&gt;0">
611 <xsl:element name="xsl:apply-templates">
612 <xsl:attribute name="mode">
613 <xsl:value-of select="$mode"/>
614 </xsl:attribute>
615 <xsl:attribute name="select">
616 <xsl:apply-templates mode="document.order"/>
617 </xsl:attribute>
618 </xsl:element>
619 </xsl:if>
620 </xsl:when>
621
622 <!-- otherwise, select each of the elements in the specified order -->
623 <xsl:otherwise>
624 <xsl:apply-templates mode="stylesheet.order"/>
625 </xsl:otherwise>
626 </xsl:choose>
627 <xsl:text>&#xA;</xsl:text>
628 </xsl:element>
629 <xsl:apply-templates mode="titlepage.specialrules"/>
630 </xsl:template>
631
632 <!-- ==================================================================== -->
633
634 <doc:template match="t:titlepage-separator" id="titlepage-separator">
635 <refpurpose>Create templates for the separator</refpurpose>
636
637 <refdescription>
638 <para>The title page is separated from the content which follows it by
639 the markup specified in the <literal>t:titlepage-separator</literal>
640 element.</para>
641 </refdescription>
642 </doc:template>
643
644 <xsl:template match="t:titlepage-separator">
645 <xsl:text>&#xA;&#xA;</xsl:text>
646 <xsl:element name="xsl:template">
647 <xsl:attribute name="name">
648 <xsl:value-of select="../@t:element"/>
649 <xsl:text>.titlepage.separator</xsl:text>
650 </xsl:attribute>
651
652 <xsl:apply-templates mode="copy"/>
653 <xsl:text>&#xA;</xsl:text>
654 </xsl:element>
655 </xsl:template>
656
657 <!-- ==================================================================== -->
658
659 <doc:template match="t:titlepage-before" id="titlepage-before">
660 <refpurpose>Create templates for what precedes a title page</refpurpose>
661
662 <refdescription>
663 <para>Each side of the title page is preceded by the markup specified
664 in the <literal>t:titlepage-before</literal> element for that
665 side.</para>
666 </refdescription>
667 </doc:template>
668
669 <xsl:template match="t:titlepage-before">
670 <xsl:text>&#xA;&#xA;</xsl:text>
671 <xsl:element name="xsl:template">
672 <xsl:attribute name="name">
673 <xsl:value-of select="../@t:element"/>
674 <xsl:text>.titlepage.before.</xsl:text>
675 <xsl:value-of select="@t:side"/>
676 </xsl:attribute>
677
678 <xsl:apply-templates mode="copy"/>
679 <xsl:text>&#xA;</xsl:text>
680 </xsl:element>
681 </xsl:template>
682
683 <!-- ==================================================================== -->
684
685 <doc:template match="*" mode="copy" xmlns="" id="star_in_copy">
686 <refpurpose>Copy elements</refpurpose>
687
688 <refdescription>
689 <para>This template simply copies the elements that it applies to
690 straight through into the result tree.</para>
691 </refdescription>
692 </doc:template>
693
694 <xsl:template match="*" mode="copy">
695 <xsl:choose>
696 <xsl:when test="(name(.) = local-name(.)) and namespace-uri(.) != ''">
697 <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
698 <xsl:apply-templates select="@*" mode="copy"/>
699 <xsl:apply-templates mode="copy"/>
700 </xsl:element>
701 </xsl:when>
702 <xsl:otherwise>
703 <xsl:element name="{name(.)}">
704 <xsl:apply-templates select="@*" mode="copy"/>
705 <xsl:apply-templates mode="copy"/>
706 </xsl:element>
707 </xsl:otherwise>
708 </xsl:choose>
709 </xsl:template>
710
711 <!-- ==================================================================== -->
712
713 <doc:template match="@*" mode="copy" xmlns="" id="attr_star_in_copy">
714 <refpurpose>Copy attributes</refpurpose>
715
716 <refdescription>
717 <para>This template simply copies the attributes that it applies to
718 straight through into the result tree.</para>
719 </refdescription>
720 </doc:template>
721
722 <xsl:template match="@*" mode="copy">
723 <xsl:choose>
724 <xsl:when test="(name(.) = local-name(.)) and namespace-uri(.) != ''">
725 <xsl:attribute name="{name(.)}" namespace="{namespace-uri(.)}">
726 <xsl:value-of select="."/>
727 </xsl:attribute>
728 </xsl:when>
729 <xsl:otherwise>
730 <xsl:attribute name="{name(.)}">
731 <xsl:value-of select="."/>
732 </xsl:attribute>
733 </xsl:otherwise>
734 </xsl:choose>
735 </xsl:template>
736
737 <!-- ==================================================================== -->
738
739 <doc:template match="*" mode="document.order" xmlns="" id="attr_star_in_document .order">
740 <refpurpose>Create rules to process titlepage elements in document order</refpur pose>
741
742 <refdescription>
743 <para>This template is called to process all of the children of the
744 <literal>t:titlepage-content</literal> element. It creates the hairy
745 select expression necessary to process each of those elements in
746 the title page.</para>
747
748 <para>Note that this template automatically handles the case where
749 some DocBook elements, like title and subtitle, can occur both inside
750 the *info elements where metadata is usually stored and outside.
751 </para>
752
753 <para>It also automatically calculates the name for the *info container
754 and handles elements that have historically had containers with different
755 names.</para>
756
757 </refdescription>
758 </doc:template>
759
760 <xsl:template match="*" mode="document.order">
761 <xsl:variable name="docinfo">
762 <xsl:value-of select="ancestor::t:titlepage/@t:element"/>
763 <xsl:text>info</xsl:text>
764 </xsl:variable>
765
766 <xsl:variable name="altinfo">
767 <xsl:choose>
768 <xsl:when test="ancestor::t:titlepage/@t:element='article'">
769 <xsl:text>artheader</xsl:text>
770 </xsl:when>
771 <xsl:when test="ancestor::t:titlepage/@t:element='qandaset'">
772 <xsl:text>blockinfo</xsl:text>
773 </xsl:when>
774 <xsl:when test="ancestor::t:titlepage/@t:element='section'"></xsl:when>
775 <xsl:when test="ancestor::t:titlepage/@t:element='sect1'"></xsl:when>
776 <xsl:when test="ancestor::t:titlepage/@t:element='sect2'"></xsl:when>
777 <xsl:when test="ancestor::t:titlepage/@t:element='sect3'"></xsl:when>
778 <xsl:when test="ancestor::t:titlepage/@t:element='sect4'"></xsl:when>
779 <xsl:when test="ancestor::t:titlepage/@t:element='sect5'"></xsl:when>
780 <xsl:when test="ancestor::t:titlepage/@t:element='book'"></xsl:when>
781 <xsl:when test="ancestor::t:titlepage/@t:element='set'"></xsl:when>
782 <xsl:when test="ancestor::t:titlepage/@t:element='topic'"></xsl:when>
783 <xsl:otherwise>docinfo</xsl:otherwise>
784 </xsl:choose>
785 </xsl:variable>
786
787 <xsl:variable name="side">
788 <xsl:choose>
789 <xsl:when test="ancestor::t:titlepage-content/@t:side">
790 <xsl:value-of select="ancestor::t:titlepage-content/@t:side"/>
791 </xsl:when>
792 <xsl:otherwise>
793 <xsl:text>recto</xsl:text>
794 </xsl:otherwise>
795 </xsl:choose>
796 </xsl:variable>
797
798 <xsl:variable name="mode">
799 <xsl:value-of select="ancestor::t:titlepage/@t:element"/>
800 <xsl:text>.titlepage.</xsl:text>
801 <xsl:value-of select="$side"/>
802 <xsl:text>.auto.mode</xsl:text>
803 </xsl:variable>
804
805 <xsl:if test="preceding-sibling::*">
806 <xsl:text>|</xsl:text>
807 </xsl:if>
808
809 <xsl:value-of select="$docinfo"/>
810 <xsl:text>/</xsl:text>
811 <xsl:value-of select="name(.)"/>
812 <xsl:if test="@t:predicate">
813 <xsl:value-of select="@t:predicate"/>
814 </xsl:if>
815
816 <xsl:if test="$altinfo != ''">
817 <xsl:text>|</xsl:text>
818 <xsl:value-of select="$altinfo"/>
819 <xsl:text>/</xsl:text>
820 <xsl:value-of select="name(.)"/>
821 <xsl:if test="@t:predicate">
822 <xsl:value-of select="@t:predicate"/>
823 </xsl:if>
824 </xsl:if>
825
826 <!-- info -->
827 <xsl:text>|info</xsl:text>
828 <xsl:text>/</xsl:text>
829 <xsl:value-of select="name(.)"/>
830 <xsl:if test="@t:predicate">
831 <xsl:value-of select="@t:predicate"/>
832 </xsl:if>
833
834 <xsl:if test="local-name(.) = 'title'
835 or local-name(.) = 'subtitle'
836 or local-name(.) = 'titleabbrev'">
837 <xsl:text>|</xsl:text>
838 <xsl:value-of select="name(.)"/>
839 <xsl:if test="@t:predicate">
840 <xsl:value-of select="@t:predicate"/>
841 </xsl:if>
842 </xsl:if>
843 </xsl:template>
844
845 <!-- ==================================================================== -->
846
847 <doc:template match="*" mode="document.order" xmlns="" id="star_in_document.orde r">
848 <refpurpose>Create rules to process titlepage elements in stylesheet order</refp urpose>
849
850 <refdescription>
851 <para>This template is called to process all of the children of the
852 <literal>t:titlepage-content</literal> element. It creates the set
853 of <literal>xsl:apply-templates</literal> elements necessary
854 process each of those elements in the title page.</para>
855
856 <para>Note that this template automatically handles the case where
857 some DocBook elements, like title and subtitle, can occur both inside
858 the *info elements where metadata is usually stored and outside.
859 </para>
860
861 <para>It also automatically calculates the name for the *info container
862 and handles elements that have historically had containers with different
863 names.</para>
864
865 </refdescription>
866 </doc:template>
867
868 <xsl:template match="*" mode="stylesheet.order">
869 <xsl:variable name="docinfo">
870 <xsl:value-of select="ancestor::t:titlepage/@t:element"/>
871 <xsl:text>info</xsl:text>
872 </xsl:variable>
873
874 <xsl:variable name="altinfo">
875 <xsl:choose>
876 <xsl:when test="ancestor::t:titlepage/@t:element='article'">
877 <xsl:text>artheader</xsl:text>
878 </xsl:when>
879 <xsl:when test="ancestor::t:titlepage/@t:element='qandaset'">
880 <xsl:text>blockinfo</xsl:text>
881 </xsl:when>
882 <xsl:when test="ancestor::t:titlepage/@t:element='section'"></xsl:when>
883 <xsl:when test="ancestor::t:titlepage/@t:element='sect1'"></xsl:when>
884 <xsl:when test="ancestor::t:titlepage/@t:element='sect2'"></xsl:when>
885 <xsl:when test="ancestor::t:titlepage/@t:element='sect3'"></xsl:when>
886 <xsl:when test="ancestor::t:titlepage/@t:element='sect4'"></xsl:when>
887 <xsl:when test="ancestor::t:titlepage/@t:element='sect5'"></xsl:when>
888 <xsl:when test="ancestor::t:titlepage/@t:element='book'"></xsl:when>
889 <xsl:when test="ancestor::t:titlepage/@t:element='set'"></xsl:when>
890 <xsl:when test="ancestor::t:titlepage/@t:element='topic'"></xsl:when>
891 <xsl:otherwise>docinfo</xsl:otherwise>
892 </xsl:choose>
893 </xsl:variable>
894
895 <xsl:variable name="side">
896 <xsl:choose>
897 <xsl:when test="ancestor::t:titlepage-content/@t:side">
898 <xsl:value-of select="ancestor::t:titlepage-content/@t:side"/>
899 </xsl:when>
900 <xsl:otherwise>recto</xsl:otherwise>
901 </xsl:choose>
902 </xsl:variable>
903
904 <xsl:variable name="mode">
905 <xsl:value-of select="ancestor::t:titlepage/@t:element"/>
906 <xsl:text>.titlepage.</xsl:text>
907 <xsl:value-of select="$side"/>
908 <xsl:text>.auto.mode</xsl:text>
909 </xsl:variable>
910
911 <xsl:text>&#xA; </xsl:text>
912
913 <xsl:choose>
914 <xsl:when test="@t:force and @t:force != '0'">
915 <xsl:choose>
916 <xsl:when test="@t:named-template">
917 <xsl:element name="{../../@t:wrapper}" namespace="{$ns}">
918 <xsl:attribute name="xsl:use-attribute-sets">
919 <xsl:value-of select="../../@t:element"/>
920 <xsl:text>.titlepage.</xsl:text>
921 <xsl:value-of select="../@t:side"/>
922 <xsl:text>.style</xsl:text>
923 </xsl:attribute>
924 <xsl:for-each select="@*">
925 <xsl:if test="not(starts-with(namespace-uri(.),
926 'http://nwalsh.com/docbook/xsl/template/1.0')) ">
927 <xsl:attribute name="{name(.)}" namespace="{namespace-uri(.)}">
928 <xsl:value-of select="."/>
929 </xsl:attribute>
930 </xsl:if>
931 </xsl:for-each>
932 <xsl:text>&#xA;</xsl:text>
933 <xsl:element name="xsl:call-template">
934 <xsl:attribute name="name">
935 <xsl:value-of select="@t:named-template"/>
936 </xsl:attribute>
937 <xsl:for-each select="@*">
938 <xsl:if test="namespace-uri(.)='http://nwalsh.com/docbook/xsl/te mplate/1.0/param'">
939 <xsl:text>&#xA;</xsl:text>
940 <xsl:element name="xsl:with-param">
941 <xsl:attribute name="name">
942 <xsl:value-of select="local-name(.)"/>
943 </xsl:attribute>
944 <xsl:attribute name="select">
945 <xsl:value-of select="."/>
946 </xsl:attribute>
947 </xsl:element>
948 </xsl:if>
949 </xsl:for-each>
950 <xsl:text>&#xA;</xsl:text>
951 </xsl:element>
952 </xsl:element>
953 </xsl:when>
954 <xsl:otherwise>
955 <xsl:message terminate="yes">
956 <xsl:text>Force can only be used with named-templates.</xsl:text>
957 </xsl:message>
958 </xsl:otherwise>
959 </xsl:choose>
960 </xsl:when>
961 <xsl:otherwise>
962
963 <xsl:choose>
964 <xsl:when test="local-name(.) = 'title'
965 or local-name(.) = 'subtitle'
966 or local-name(.) = 'titleabbrev'">
967 <!-- the title, subtitle, and titleabbrev elements are special -->
968 <xsl:element name="xsl:choose">
969 <xsl:text>&#xA; </xsl:text>
970 <xsl:element name="xsl:when">
971 <xsl:attribute name="test">
972 <xsl:value-of select="$docinfo"/>
973 <xsl:text>/</xsl:text>
974 <xsl:value-of select="name(.)"/>
975 </xsl:attribute>
976 <xsl:text>&#xA; </xsl:text>
977 <xsl:element name="xsl:apply-templates">
978 <xsl:attribute name="mode">
979 <xsl:value-of select="$mode"/>
980 </xsl:attribute>
981 <xsl:attribute name="select">
982 <xsl:value-of select="$docinfo"/>
983 <xsl:text>/</xsl:text>
984 <xsl:value-of select="name(.)"/>
985 <xsl:if test="@t:predicate">
986 <xsl:value-of select="@t:predicate"/>
987 </xsl:if>
988 </xsl:attribute>
989 </xsl:element>
990 <xsl:text>&#xA; </xsl:text>
991 </xsl:element>
992
993 <xsl:if test="$altinfo != ''">
994 <xsl:text>&#xA; </xsl:text>
995 <xsl:element name="xsl:when">
996 <xsl:attribute name="test">
997 <xsl:value-of select="$altinfo"/>
998 <xsl:text>/</xsl:text>
999 <xsl:value-of select="name(.)"/>
1000 </xsl:attribute>
1001 <xsl:text>&#xA; </xsl:text>
1002 <xsl:element name="xsl:apply-templates">
1003 <xsl:attribute name="mode">
1004 <xsl:value-of select="$mode"/>
1005 </xsl:attribute>
1006 <xsl:attribute name="select">
1007 <xsl:value-of select="$altinfo"/>
1008 <xsl:text>/</xsl:text>
1009 <xsl:value-of select="name(.)"/>
1010 <xsl:if test="@t:predicate">
1011 <xsl:value-of select="@t:predicate"/>
1012 </xsl:if>
1013 </xsl:attribute>
1014 </xsl:element>
1015 <xsl:text>&#xA; </xsl:text>
1016 </xsl:element>
1017 </xsl:if>
1018
1019 <!-- info -->
1020 <xsl:text>&#xA; </xsl:text>
1021 <xsl:element name="xsl:when">
1022 <xsl:attribute name="test">
1023 <xsl:value-of select="'info'"/>
1024 <xsl:text>/</xsl:text>
1025 <xsl:value-of select="name(.)"/>
1026 </xsl:attribute>
1027 <xsl:text>&#xA; </xsl:text>
1028 <xsl:element name="xsl:apply-templates">
1029 <xsl:attribute name="mode">
1030 <xsl:value-of select="$mode"/>
1031 </xsl:attribute>
1032 <xsl:attribute name="select">
1033 <xsl:value-of select="'info'"/>
1034 <xsl:text>/</xsl:text>
1035 <xsl:value-of select="name(.)"/>
1036 <xsl:if test="@t:predicate">
1037 <xsl:value-of select="@t:predicate"/>
1038 </xsl:if>
1039 </xsl:attribute>
1040 </xsl:element>
1041 <xsl:text>&#xA; </xsl:text>
1042 </xsl:element>
1043
1044 <xsl:text>&#xA; </xsl:text>
1045 <xsl:element name="xsl:when">
1046 <xsl:attribute name="test">
1047 <xsl:value-of select="name(.)"/>
1048 </xsl:attribute>
1049 <xsl:text>&#xA; </xsl:text>
1050 <xsl:element name="xsl:apply-templates">
1051 <xsl:attribute name="mode">
1052 <xsl:value-of select="$mode"/>
1053 </xsl:attribute>
1054 <xsl:attribute name="select">
1055 <xsl:value-of select="name(.)"/>
1056 <xsl:if test="@t:predicate">
1057 <xsl:value-of select="@t:predicate"/>
1058 </xsl:if>
1059 </xsl:attribute>
1060 </xsl:element>
1061 <xsl:text>&#xA; </xsl:text>
1062 </xsl:element>
1063 <xsl:text>&#xA; </xsl:text>
1064 </xsl:element>
1065 <xsl:text>&#xA;</xsl:text>
1066 </xsl:when>
1067 <xsl:otherwise>
1068
1069 <!-- first take care of the $docinfo version -->
1070 <xsl:element name="xsl:apply-templates">
1071 <xsl:attribute name="mode">
1072 <xsl:value-of select="$mode"/>
1073 </xsl:attribute>
1074 <xsl:attribute name="select">
1075 <xsl:value-of select="$docinfo"/>
1076 <xsl:text>/</xsl:text>
1077 <xsl:value-of select="name(.)"/>
1078 <xsl:if test="@t:predicate">
1079 <xsl:value-of select="@t:predicate"/>
1080 </xsl:if>
1081 </xsl:attribute>
1082 </xsl:element>
1083
1084 <!-- then take care of the $altinfo version -->
1085 <xsl:if test="$altinfo != ''">
1086 <xsl:text>&#xA; </xsl:text>
1087 <xsl:element name="xsl:apply-templates">
1088 <xsl:attribute name="mode">
1089 <xsl:value-of select="$mode"/>
1090 </xsl:attribute>
1091 <xsl:attribute name="select">
1092 <xsl:value-of select="$altinfo"/>
1093 <xsl:text>/</xsl:text>
1094 <xsl:value-of select="name(.)"/>
1095 <xsl:if test="@t:predicate">
1096 <xsl:value-of select="@t:predicate"/>
1097 </xsl:if>
1098 </xsl:attribute>
1099 </xsl:element>
1100 </xsl:if>
1101
1102 <!-- info -->
1103 <xsl:text>&#xA; </xsl:text>
1104 <xsl:element name="xsl:apply-templates">
1105 <xsl:attribute name="mode">
1106 <xsl:value-of select="$mode"/>
1107 </xsl:attribute>
1108 <xsl:attribute name="select">
1109 <xsl:value-of select="'info'"/>
1110 <xsl:text>/</xsl:text>
1111 <xsl:value-of select="name(.)"/>
1112 <xsl:if test="@t:predicate">
1113 <xsl:value-of select="@t:predicate"/>
1114 </xsl:if>
1115 </xsl:attribute>
1116 </xsl:element>
1117 </xsl:otherwise>
1118 </xsl:choose>
1119 </xsl:otherwise>
1120 </xsl:choose>
1121 </xsl:template>
1122
1123 <!-- ==================================================================== -->
1124
1125 <doc:template match="*" mode="titlepage.specialrules" xmlns=""
1126 id="star_in_titlepage.specialrules">
1127 <refpurpose>Create templates for special rules</refpurpose>
1128
1129 <refdescription>
1130 <para>This template is called to process all of the descendants of the
1131 <literal>t:titlepage-content</literal> element that require special
1132 processing. At present, that's just <literal>t:or</literal> elements.
1133 </para>
1134 </refdescription>
1135 </doc:template>
1136
1137 <xsl:template match="*" mode="titlepage.specialrules">
1138 <xsl:variable name="side">
1139 <xsl:choose>
1140 <xsl:when test="ancestor::t:titlepage-content/@t:side">
1141 <xsl:value-of select="ancestor::t:titlepage-content/@t:side"/>
1142 </xsl:when>
1143 <xsl:otherwise>recto</xsl:otherwise>
1144 </xsl:choose>
1145 </xsl:variable>
1146
1147 <xsl:variable name="mode">
1148 <xsl:value-of select="ancestor::t:titlepage/@t:element"/>
1149 <xsl:text>.titlepage.</xsl:text>
1150 <xsl:value-of select="$side"/>
1151 <xsl:text>.auto.mode</xsl:text>
1152 </xsl:variable>
1153
1154 <xsl:choose>
1155 <xsl:when test="name(.)='t:or'">
1156 <xsl:apply-templates select="*" mode="titlepage.specialrules"/>
1157 </xsl:when>
1158 <xsl:otherwise>
1159 <xsl:if test="*"><!-- does this element have children? -->
1160 <xsl:text>&#xA;&#xA;</xsl:text>
1161 <xsl:element name="xsl:template">
1162 <xsl:attribute name="match">
1163 <xsl:value-of select="name(.)"/>
1164 </xsl:attribute>
1165 <xsl:attribute name="mode">
1166 <xsl:value-of select="$mode"/>
1167 </xsl:attribute>
1168 <xsl:apply-templates select="*" mode="titlepage.subrules"/>
1169 <xsl:text>&#xA;</xsl:text>
1170 </xsl:element>
1171 </xsl:if>
1172 </xsl:otherwise>
1173 </xsl:choose>
1174 </xsl:template>
1175
1176 <!-- ==================================================================== -->
1177
1178 <doc:template match="*" mode="titlepage.subrules" xmlns=""
1179 id="star_in_titlepage.subrules">
1180 <refpurpose>Create template for individual special rules</refpurpose>
1181
1182 <refdescription>
1183 <para>This template is called to process the children of special
1184 template elements.
1185 </para>
1186 </refdescription>
1187 </doc:template>
1188
1189 <xsl:template match="*" mode="titlepage.subrules">
1190 <xsl:variable name="side">
1191 <xsl:choose>
1192 <xsl:when test="ancestor::t:titlepage-content/@t:side">
1193 <xsl:value-of select="ancestor::t:titlepage-content/@t:side"/>
1194 </xsl:when>
1195 <xsl:otherwise>recto</xsl:otherwise>
1196 </xsl:choose>
1197 </xsl:variable>
1198
1199 <xsl:variable name="mode">
1200 <xsl:value-of select="ancestor::t:titlepage/@t:element"/>
1201 <xsl:text>.titlepage.</xsl:text>
1202 <xsl:value-of select="$side"/>
1203 <xsl:text>.auto.mode</xsl:text>
1204 </xsl:variable>
1205
1206 <xsl:element name="xsl:apply-templates">
1207 <xsl:attribute name="select">
1208 <xsl:value-of select="name(.)"/>
1209 </xsl:attribute>
1210 <xsl:attribute name="mode">
1211 <xsl:value-of select="$mode"/>
1212 </xsl:attribute>
1213 </xsl:element>
1214 </xsl:template>
1215
1216 <!-- ==================================================================== -->
1217
1218 <doc:template match="t:or" xmlns="" id="or">
1219 <refpurpose>Process the t:or special rule</refpurpose>
1220
1221 <refdescription>
1222 <para>This template processes t:or.</para>
1223 </refdescription>
1224 </doc:template>
1225
1226 <xsl:template match="t:or">
1227 <xsl:variable name="side">
1228 <xsl:choose>
1229 <xsl:when test="ancestor::t:titlepage-content/@t:side">
1230 <xsl:value-of select="ancestor::t:titlepage-content/@t:side"/>
1231 </xsl:when>
1232 <xsl:otherwise>recto</xsl:otherwise>
1233 </xsl:choose>
1234 </xsl:variable>
1235
1236 <xsl:variable name="mode">
1237 <xsl:value-of select="ancestor::t:titlepage/@t:element"/>
1238 <xsl:text>.titlepage.</xsl:text>
1239 <xsl:value-of select="$side"/>
1240 <xsl:text>.auto.mode</xsl:text>
1241 </xsl:variable>
1242
1243 <xsl:text>&#xA; </xsl:text>
1244 <xsl:element name="xsl:apply-templates">
1245 <xsl:attribute name="select">
1246 <xsl:call-template name="element-or-list"/>
1247 </xsl:attribute>
1248 <xsl:attribute name="mode">
1249 <xsl:value-of select="$mode"/>
1250 </xsl:attribute>
1251 </xsl:element>
1252 </xsl:template>
1253
1254 <!-- ==================================================================== -->
1255
1256 <doc:template match="t:or" mode="titlepage.subrules" xmlns=""
1257 id="or_in_titlepage.subrules">
1258 <refpurpose>Process the t:or special rule in
1259 titlepage.subrules mode</refpurpose>
1260
1261 <refdescription>
1262 <para>The titlepage.subrules mode doesn't apply to t:or, so just
1263 reprocess this node in the normal mode.</para>
1264 </refdescription>
1265 </doc:template>
1266
1267 <xsl:template match="t:or" mode="titlepage.subrules">
1268 <xsl:apply-templates select="."/><!-- use normal mode -->
1269 </xsl:template>
1270
1271 <!-- ==================================================================== -->
1272
1273 <doc:template name="element-or-list" xmlns="">
1274 <refpurpose>Construct the "or-list" used in the select attribute for
1275 special rules.</refpurpose>
1276
1277 <refdescription>
1278 <para>Walk through each of the children of t:or, producing the
1279 text of the select attribute.</para>
1280 </refdescription>
1281 </doc:template>
1282
1283 <xsl:template name="element-or-list">
1284 <xsl:param name="elements" select="*"/>
1285 <xsl:param name="element.count" select="count($elements)"/>
1286 <xsl:param name="count" select="1"/>
1287 <xsl:param name="orlist"></xsl:param>
1288
1289 <xsl:choose>
1290 <xsl:when test="$count>$element.count">
1291 <xsl:value-of select="$orlist"/>
1292 </xsl:when>
1293 <xsl:otherwise>
1294 <xsl:call-template name="element-or-list">
1295 <xsl:with-param name="elements" select="$elements"/>
1296 <xsl:with-param name="element.count" select="$element.count"/>
1297 <xsl:with-param name="count" select="$count+1"/>
1298 <xsl:with-param name="orlist">
1299 <xsl:value-of select="$orlist"/>
1300 <xsl:if test="not($orlist='')">|</xsl:if>
1301 <xsl:value-of select="name($elements[position()=$count])"/>
1302 </xsl:with-param>
1303 </xsl:call-template>
1304 </xsl:otherwise>
1305 </xsl:choose>
1306 </xsl:template>
1307
1308 <!-- ==================================================================== -->
1309
1310 </xsl:stylesheet>
OLDNEW
« no previous file with comments | « third_party/docbook-xsl-1.78.0/template/titlepage.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698