]> git.stg.codes - stg.git/blob - doc/xslt/template/titlepage.xml
Set output encoding to utf-8.
[stg.git] / doc / xslt / template / titlepage.xml
1 <?xml version="1.0"?>
2
3 <reference xml:id="template"><?dbhtml dir="template"?><?dbhtml filename="index.html"?>
4   
5   
6   <info>
7     <title>Titlepage Template Stylesheet Reference</title>
8     <releaseinfo role="meta">
9       $Id: titlepage.xsl 7058 2007-07-17 13:59:29Z xmldoc $
10     </releaseinfo>
11   </info>
12   <partintro xml:id="intro_partintro">
13     <title>Introduction</title>
14     
15 <para>This is technical reference documentation for the
16       “titlepage” templates in the DocBook XSL Stylesheets.</para>
17
18     
19 <para>This is not intended to be user documentation.  It is
20       provided for developers writing customization layers for the
21       stylesheets.</para>
22
23   </partintro>
24
25 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="templates">
26 <refnamediv>
27 <refname>t:templates</refname>
28 <refpurpose>Construct a stylesheet for the templates provided</refpurpose>
29 </refnamediv>
30 <refsynopsisdiv>
31 <synopsis>&lt;xsl:template match="t:templates"/&gt;</synopsis>
32 </refsynopsisdiv>
33 <refsect1><title>Description</title>
34
35 <para>The <literal>t:templates</literal> element is the root of a
36 set of templates. This template creates an appropriate
37 <literal>xsl:stylesheet</literal> for the templates.</para>
38
39
40
41 <para>If the <literal>t:templates</literal> element has a
42 <literal>base-stylesheet</literal> attribute, an
43 <literal>xsl:import</literal> statement is constructed for it.</para>
44
45 </refsect1></refentry>
46
47 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="star">
48 <refnamediv>
49 <refname>xsl:*</refname>
50 <refpurpose>Copy xsl: elements straight through</refpurpose>
51 </refnamediv>
52 <refsynopsisdiv>
53 <synopsis>&lt;xsl:template match="xsl:*"/&gt;</synopsis>
54 </refsynopsisdiv>
55 <refsect1><title>Description</title>
56
57 <para>This template simply copies the xsl: elements
58 straight through into the result tree.</para>
59
60 </refsect1></refentry>
61
62 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="titlepage">
63 <refnamediv>
64 <refname>t:titlepage</refname>
65 <refpurpose>Create the templates necessary to construct a title page</refpurpose>
66 </refnamediv>
67 <refsynopsisdiv>
68 <synopsis>&lt;xsl:template match="t:titlepage"/&gt;</synopsis>
69 </refsynopsisdiv>
70 <refsect1><title>Description</title>
71
72 <para>The <literal>t:titlepage</literal> element creates a set of
73 templates for processing the titlepage for an element. The
74 <quote>root</quote> of this template set is the template named
75 <quote><literal>wrapper.titlepage</literal></quote>. That is the
76 template that should be called to generate the title page.
77 </para>
78
79
80
81 <para>The <literal>t:titlepage</literal> element has three attributes:
82
83
84 <variablelist>
85 <varlistentry><term>element</term>
86 <listitem>
87 <para>The name of the source document element for which
88 these templates apply. In other words, to make a title page for the
89 <tag>article</tag> element, set the
90 <tag class="attribute">element</tag> attribute to
91 <quote><literal>article</literal></quote>. This attribute is required.
92 </para>
93 </listitem>
94 </varlistentry>
95 <varlistentry><term>wrapper</term>
96 <listitem>
97 <para>The entire title page can be wrapped with an element.
98 This attribute identifies that element.
99 </para>
100 </listitem>
101 </varlistentry>
102 <varlistentry><term>class</term>
103 <listitem>
104 <para>If the <tag class="attribute">class</tag> attribute
105 is set, a <tag class="attribute">class</tag> attribute with this
106 value will be added to the wrapper element that surrounds the entire
107 title page.
108 </para>
109 </listitem>
110 </varlistentry>
111 </variablelist>
112
113 </para>
114
115
116
117 <para>Any other attributes are copied through literally to the
118 wrapper element.</para>
119
120
121
122 <para>The content of a <literal>t:titlepage</literal> is one or
123 more <literal>t:titlepage-content</literal>,
124 <literal>t:titlepage-separator</literal>, and
125 <literal>t:titlepage-before</literal> elements.</para>
126
127
128
129 <para>Each of these elements may be provided for the <quote>recto</quote>
130 and <quote>verso</quote> sides of the title page.</para>
131
132
133 </refsect1></refentry>
134
135 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="attr_star_in_copy.literal.atts">
136 <refnamediv>
137 <refname>@* (in copy.literal.atts mode)</refname>
138 <refpurpose>Copy t:titlepage attributes</refpurpose>
139 </refnamediv>
140 <refsynopsisdiv>
141 <synopsis>&lt;xsl:template match="@*" mode="copy.literal.atts"/&gt;</synopsis>
142 </refsynopsisdiv>
143 <refsect1><title>Description</title>
144
145 <para>This template copies all of the <quote>other</quote> attributes
146 from a <literal>t:titlepage</literal> element onto the specified
147 wrapper.</para>
148
149 </refsect1></refentry>
150
151 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="titlepage-content">
152 <refnamediv>
153 <refname>t:titlepage-content</refname>
154 <refpurpose>Create templates for the content of one side of a title page</refpurpose>
155 </refnamediv>
156 <refsynopsisdiv>
157 <synopsis>&lt;xsl:template match="t:titlepage-content"/&gt;</synopsis>
158 </refsynopsisdiv>
159 <refsect1><title>Description</title>
160
161 <para>The title page content, that is, the elements from the source
162 document that are rendered on the title page, can be controlled independently
163 for the recto and verso sides of the title page.</para>
164
165
166
167 <para>The <literal>t:titlepage-content</literal> element has two attributes:
168
169
170 <variablelist>
171 <varlistentry><term>side</term>
172 <listitem>
173 <para>Identifies the side of the page to which this title
174 page content applies. The
175 <tag class="attribute">side</tag> attribute is required and
176 must be set to either 
177 <quote><literal>recto</literal></quote> or
178 <quote><literal>verso</literal></quote>. In addition, you must specify
179 exactly one <literal>t:titlepage-content</literal> for each side
180 within each <literal>t:titlepage</literal>.</para>
181
182 </listitem>
183 </varlistentry>
184 <varlistentry><term>order</term>
185 <listitem>
186 <para>Indicates how the order of the elements presented on
187 the title page is determined. If the
188 <tag class="attribute">order</tag> is
189 <quote><literal>document</literal></quote>, the elements are presented
190 in document order. Otherwise (if the
191 <tag class="attribute">order</tag> is
192 <quote><literal>stylesheet</literal></quote>), the elements are presented
193 in the order that they appear in the template (and consequently in
194 the stylesheet).</para>
195
196 </listitem>
197 </varlistentry>
198 </variablelist>
199
200 </para>
201
202
203
204 <para>The content of a <literal>t:titlepage-content</literal> element is
205 a list of element names. These names should be unqualified.  They identify
206 the elements in the source document that should appear on the title page.
207 </para>
208
209
210
211 <para>Each element may have a single attribute:
212 <tag class="attribute">predicate</tag>. The value of this
213 attribute is used as a predicate for the expression that matches
214 the element on which it occurs.</para>
215
216
217
218 <para>In other words, to put only the first three authors on the
219 recto-side of a title
220 page, you could specify:
221
222 <screen>
223   &lt;t:titlepage-contents side="recto"&gt;
224     &lt;!-- other titlepage elements --&gt;
225     &lt;author predicate="[count(previous-sibling::author)&lt;2]"/&gt;
226     &lt;!-- other titlepage elements --&gt;
227   &lt;/t:titlepage-contents&gt;
228 </screen>
229 </para>
230
231
232
233 <para>Usually, the elements so named are empty. But it is possible to
234 make one level of selection within them. Suppose that you want to
235 process <literal>authorgroup</literal> elements on the title page, but
236 you want to select only proper authors, editors, or corporate authors,
237 not collaborators or other credited authors.</para>
238
239
240
241 <para>In that case, you can put a <literal>t:or</literal> group inside
242 the <literal>authorgroup</literal> element:
243
244 <screen>
245   &lt;t:titlepage-contents side="recto"&gt;
246     &lt;!-- other titlepage elements --&gt;
247     &lt;authorgroup&gt;
248       &lt;t:or&gt;
249         &lt;author/&gt;
250         &lt;editor/&gt;
251         &lt;corpauthor/&gt;
252       &lt;/t:or&gt;
253     &lt;/authorgroup&gt;
254     &lt;!-- other titlepage elements --&gt;
255   &lt;/t:titlepage-contents&gt;
256 </screen>
257 </para>
258
259
260
261 <para>This will have the effect of automatically generating a template
262 for processing <literal>authorgroup</literal>s in the title page mode,
263 selecting only the specified children. If you need more complex processing,
264 you'll have to construct the templates by hand.</para>
265
266
267 </refsect1></refentry>
268
269 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="titlepage-separator">
270 <refnamediv>
271 <refname>t:titlepage-separator</refname>
272 <refpurpose>Create templates for the separator</refpurpose>
273 </refnamediv>
274 <refsynopsisdiv>
275 <synopsis>&lt;xsl:template match="t:titlepage-separator"/&gt;</synopsis>
276 </refsynopsisdiv>
277 <refsect1><title>Description</title>
278
279 <para>The title page is separated from the content which follows it by
280 the markup specified in the <literal>t:titlepage-separator</literal>
281 element.</para>
282
283 </refsect1></refentry>
284
285 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="titlepage-before">
286 <refnamediv>
287 <refname>t:titlepage-before</refname>
288 <refpurpose>Create templates for what precedes a title page</refpurpose>
289 </refnamediv>
290 <refsynopsisdiv>
291 <synopsis>&lt;xsl:template match="t:titlepage-before"/&gt;</synopsis>
292 </refsynopsisdiv>
293 <refsect1><title>Description</title>
294
295 <para>Each side of the title page is preceded by the markup specified
296 in the <literal>t:titlepage-before</literal> element for that
297 side.</para>
298
299 </refsect1></refentry>
300
301 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="star_in_copy">
302 <refnamediv>
303 <refname>* (in copy mode)</refname>
304 <refpurpose>Copy elements</refpurpose>
305 </refnamediv>
306 <refsynopsisdiv>
307 <synopsis>&lt;xsl:template match="*" mode="copy"/&gt;</synopsis>
308 </refsynopsisdiv>
309 <refsect1><title>Description</title>
310
311 <para>This template simply copies the elements that it applies to
312 straight through into the result tree.</para>
313
314 </refsect1></refentry>
315
316 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="attr_star_in_copy">
317 <refnamediv>
318 <refname>@* (in copy mode)</refname>
319 <refpurpose>Copy attributes</refpurpose>
320 </refnamediv>
321 <refsynopsisdiv>
322 <synopsis>&lt;xsl:template match="@*" mode="copy"/&gt;</synopsis>
323 </refsynopsisdiv>
324 <refsect1><title>Description</title>
325
326 <para>This template simply copies the attributes that it applies to
327 straight through into the result tree.</para>
328
329 </refsect1></refentry>
330
331 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="attr_star_in_document.order">
332 <refnamediv>
333 <refname>* (in document.order mode)</refname>
334 <refpurpose>Create rules to process titlepage elements in document order</refpurpose>
335 </refnamediv>
336 <refsynopsisdiv>
337 <synopsis>&lt;xsl:template match="*" mode="document.order"/&gt;</synopsis>
338 </refsynopsisdiv>
339 <refsect1><title>Description</title>
340
341 <para>This template is called to process all of the children of the
342 <literal>t:titlepage-content</literal> element. It creates the hairy
343 select expression necessary to process each of those elements in
344 the title page.</para>
345
346
347
348 <para>Note that this template automatically handles the case where
349 some DocBook elements, like title and subtitle, can occur both inside
350 the *info elements where metadata is usually stored and outside.
351 </para>
352
353
354
355 <para>It also automatically calculates the name for the *info container
356 and handles elements that have historically had containers with different
357 names.</para>
358
359
360 </refsect1></refentry>
361
362 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="star_in_document.order">
363 <refnamediv>
364 <refname>* (in document.order mode)</refname>
365 <refpurpose>Create rules to process titlepage elements in stylesheet order</refpurpose>
366 </refnamediv>
367 <refsynopsisdiv>
368 <synopsis>&lt;xsl:template match="*" mode="document.order"/&gt;</synopsis>
369 </refsynopsisdiv>
370 <refsect1><title>Description</title>
371
372 <para>This template is called to process all of the children of the
373 <literal>t:titlepage-content</literal> element. It creates the set
374 of <literal>xsl:apply-templates</literal> elements necessary
375 process each of those elements in the title page.</para>
376
377
378
379 <para>Note that this template automatically handles the case where
380 some DocBook elements, like title and subtitle, can occur both inside
381 the *info elements where metadata is usually stored and outside.
382 </para>
383
384
385
386 <para>It also automatically calculates the name for the *info container
387 and handles elements that have historically had containers with different
388 names.</para>
389
390
391 </refsect1></refentry>
392
393 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="star_in_titlepage.specialrules">
394 <refnamediv>
395 <refname>* (in titlepage.specialrules mode)</refname>
396 <refpurpose>Create templates for special rules</refpurpose>
397 </refnamediv>
398 <refsynopsisdiv>
399 <synopsis>&lt;xsl:template match="*" mode="titlepage.specialrules"/&gt;</synopsis>
400 </refsynopsisdiv>
401 <refsect1><title>Description</title>
402
403 <para>This template is called to process all of the descendants of the
404 <literal>t:titlepage-content</literal> element that require special
405 processing. At present, that's just <literal>t:or</literal> elements.
406 </para>
407
408 </refsect1></refentry>
409
410 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="star_in_titlepage.subrules">
411 <refnamediv>
412 <refname>* (in titlepage.subrules mode)</refname>
413 <refpurpose>Create template for individual special rules</refpurpose>
414 </refnamediv>
415 <refsynopsisdiv>
416 <synopsis>&lt;xsl:template match="*" mode="titlepage.subrules"/&gt;</synopsis>
417 </refsynopsisdiv>
418 <refsect1><title>Description</title>
419
420 <para>This template is called to process the children of special
421 template elements.
422 </para>
423
424 </refsect1></refentry>
425
426 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="or">
427 <refnamediv>
428 <refname>t:or</refname>
429 <refpurpose>Process the t:or special rule</refpurpose>
430 </refnamediv>
431 <refsynopsisdiv>
432 <synopsis>&lt;xsl:template match="t:or"/&gt;&lt;xsl:template match="t:or" mode="titlepage.subrules"/&gt;</synopsis>
433 </refsynopsisdiv>
434 <refsect1><title>Description</title>
435
436 <para>This template processes t:or.</para>
437
438 </refsect1></refentry>
439
440 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="or_in_titlepage.subrules">
441 <refnamediv>
442 <refname>t:or (in titlepage.subrules mode)</refname>
443 <refpurpose>Process the t:or special rule in
444 titlepage.subrules mode</refpurpose>
445 </refnamediv>
446 <refsynopsisdiv>
447 <synopsis>&lt;xsl:template match="t:or" mode="titlepage.subrules"/&gt;</synopsis>
448 </refsynopsisdiv>
449 <refsect1><title>Description</title>
450
451 <para>The titlepage.subrules mode doesn't apply to t:or, so just
452 reprocess this node in the normal mode.</para>
453
454 </refsect1></refentry>
455
456 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.element-or-list">
457 <refnamediv>
458 <refname>element-or-list</refname>
459 <refpurpose>Construct the "or-list" used in the select attribute for
460 special rules.</refpurpose>
461 </refnamediv>
462 <refsynopsisdiv>
463 <synopsis>&lt;xsl:template name="element-or-list"&gt;
464 &lt;xsl:param name="elements" select="*"/&gt;
465 &lt;xsl:param name="element.count" select="count($elements)"/&gt;
466 &lt;xsl:param name="count" select="1"/&gt;
467 &lt;xsl:param name="orlist"/&gt;
468   ...
469 &lt;/xsl:template&gt;</synopsis>
470 </refsynopsisdiv>
471 <refsect1><title>Description</title>
472
473 <para>Walk through each of the children of t:or, producing the
474 text of the select attribute.</para>
475
476 </refsect1></refentry>
477 </reference>
478