]> git.lyx.org Git - lyx.git/blob - lib/docbook/common/refentry.xml
Release notes
[lyx.git] / lib / docbook / common / refentry.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <reference xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="refentry">
3   <info>
4     <title>Common » Refentry Metadata Template Reference</title>
5     <releaseinfo role="meta">
6     </releaseinfo>
7   </info>
8   
9   <partintro xml:id="partintro">
10     <title>Introduction</title>
11     
12 <para>This is technical reference documentation for the “refentry
13     metadata” templates in the DocBook XSL Stylesheets.</para>
14
15     
16 <para>This is not intended to be user documentation. It is provided
17     for developers writing customization layers for the stylesheets.</para>
18
19     <note>
20       
21 <para>Currently, only the manpages stylesheets make use of these
22       templates. They are, however, potentially useful elsewhere.</para>
23
24     </note>
25   </partintro>
26
27 <refentry xml:id="template.get.refentry.metadata">
28 <refnamediv>
29 <refname>get.refentry.metadata</refname>
30 <refpurpose>Gathers metadata from a refentry and its ancestors</refpurpose>
31 </refnamediv>
32 <refsynopsisdiv>
33 <synopsis>&lt;xsl:template name="get.refentry.metadata"&gt;
34 &lt;xsl:param name="refname"/&gt;
35 &lt;xsl:param name="info"/&gt;
36 &lt;xsl:param name="prefs"/&gt;
37   ...
38 &lt;/xsl:template&gt;</synopsis>
39 </refsynopsisdiv>
40 <refsect1><title>Description</title>
41     
42 <para>Reference documentation for particular commands, functions,
43     etc., is sometimes viewed in isolation from its greater "context". For
44     example, users view Unix man pages as, well, individual pages, not as
45     part of a "book" of some kind. Therefore, it is sometimes necessary to
46     embed "context" information in output for each <tag>refentry</tag>.</para>
47
48
49     
50 <para>However, one problem is that different users mark up that
51     context information in different ways. Often (usually), the
52     context information is not actually part of the content of the
53     <tag>refentry</tag> itself, but instead part of the content of a
54     parent or ancestor element to the <tag>refentry</tag>. And
55     even then, DocBook provides a variety of elements that users might
56     potentially use to mark up the same kind of information. One user
57     might use the <tag>productnumber</tag> element to mark up version
58     information about a particular product, while another might use
59     the <tag>releaseinfo</tag> element.</para>
60
61
62     
63 <para>Taking all that in mind, the
64     <function>get.refentry.metadata</function> template tries to gather
65     metadata from a <tag>refentry</tag> element and its ancestor
66     elements in an intelligent and user-configurable way. The basic
67     mechanism used in the XPath expressions throughout this stylesheet
68     is to select the relevant metadata from the *info element that is
69     closest to the actual <tag>refentry</tag> – either on the
70     <tag>refentry</tag> itself, or on its nearest ancestor.</para>
71
72
73     <note>
74       
75 <para>The <function>get.refentry.metadata</function>
76         template is actually just sort of a "driver" template; it
77         calls other templates that do the actual data collection,
78         then returns the data as a set.</para>
79
80     </note>
81
82   </refsect1><refsect1><title>Parameters</title>
83     
84 <variablelist>
85       <varlistentry>
86         <term>refname</term>
87         <listitem>
88           
89 <para>The first <tag>refname</tag> in the refentry</para>
90
91         </listitem>
92       </varlistentry>
93       <varlistentry>
94         <term>info</term>
95         <listitem>
96           
97 <para>A set of info nodes (from a <tag>refentry</tag>
98           element and its ancestors)</para>
99
100         </listitem>
101       </varlistentry>
102       <varlistentry>
103         <term>prefs</term>
104         <listitem>
105           
106 <para>A node containing user preferences (from global
107           stylesheet parameters)</para>
108
109         </listitem>
110       </varlistentry>
111     </variablelist>
112
113   </refsect1><refsect1><title>Returns</title>
114     
115 <para>Returns a node set with the following elements. The
116     descriptions are verbatim from the <literal>man(7)</literal> man
117     page.
118     
119 <variablelist>
120       <varlistentry>
121         <term>title</term>
122         <listitem>
123           
124 <para>the title of the man page (e.g., <literal>MAN</literal>)</para>
125
126         </listitem>
127       </varlistentry>
128       <varlistentry>
129         <term>section</term>
130         <listitem>
131           
132 <para>the section number the man page should be placed in (e.g.,
133           <literal>7</literal>)</para>
134
135         </listitem>
136       </varlistentry>
137       <varlistentry>
138         <term>date</term>
139         <listitem>
140           
141 <para>the date of the last revision</para>
142
143         </listitem>
144       </varlistentry>
145       <varlistentry>
146         <term>source</term>
147         <listitem>
148           
149 <para>the source of the command</para>
150
151         </listitem>
152       </varlistentry>
153       <varlistentry>
154         <term>manual</term>
155         <listitem>
156           
157 <para>the title of the manual (e.g., <citetitle>Linux
158           Programmer's Manual</citetitle>)</para>
159
160         </listitem>
161       </varlistentry>
162     </variablelist>
163
164     </para>
165
166   </refsect1></refentry>
167
168 <refentry xml:id="template.get.refentry.title">
169 <refnamediv>
170 <refname>get.refentry.title</refname>
171 <refpurpose>Gets title metadata for a refentry</refpurpose>
172 </refnamediv>
173 <refsynopsisdiv>
174 <synopsis>&lt;xsl:template name="get.refentry.title"&gt;
175 &lt;xsl:param name="refname"/&gt;
176   ...
177 &lt;/xsl:template&gt;</synopsis>
178 </refsynopsisdiv>
179 <refsect1><title>Description</title>
180     
181 <para>The <literal>man(7)</literal> man page describes this as "the
182     title of the man page (e.g., <literal>MAN</literal>). This differs
183     from <tag>refname</tag> in that, if the <tag>refentry</tag> has a
184     <tag>refentrytitle</tag>, we use that as the <tag>title</tag>;
185     otherwise, we just use first <tag>refname</tag> in the first
186     <tag>refnamediv</tag> in the source.</para>
187
188   </refsect1><refsect1><title>Parameters</title>
189     
190 <variablelist>
191       <varlistentry>
192         <term>refname</term>
193         <listitem>
194           
195 <para>The first <tag>refname</tag> in the refentry</para>
196
197         </listitem>
198       </varlistentry>
199     </variablelist>
200
201   </refsect1><refsect1><title>Returns</title>
202   
203 <para>Returns a <tag>title</tag> node.</para>
204 </refsect1></refentry>
205
206 <refentry xml:id="template.get.refentry.section">
207 <refnamediv>
208 <refname>get.refentry.section</refname>
209 <refpurpose>Gets section metadata for a refentry</refpurpose>
210 </refnamediv>
211 <refsynopsisdiv>
212 <synopsis>&lt;xsl:template name="get.refentry.section"&gt;
213 &lt;xsl:param name="refname"/&gt;
214 &lt;xsl:param name="quiet" select="0"/&gt;
215   ...
216 &lt;/xsl:template&gt;</synopsis>
217 </refsynopsisdiv>
218 <refsect1><title>Description</title>
219     
220 <para>The <literal>man(7)</literal> man page describes this as "the
221     section number the man page should be placed in (e.g.,
222     <literal>7</literal>)". If we do not find a <tag>manvolnum</tag>
223     specified in the source, and we find that the <tag>refentry</tag> is
224     for a function, we use the section number <literal>3</literal>
225     ["Library calls (functions within program libraries)"]; otherwise, we
226     default to using <literal>1</literal> ["Executable programs or shell
227     commands"].</para>
228
229   </refsect1><refsect1><title>Parameters</title>
230     
231 <variablelist>
232       <varlistentry>
233         <term>refname</term>
234         <listitem>
235           
236 <para>The first <tag>refname</tag> in the refentry</para>
237
238         </listitem>
239       </varlistentry>
240       <varlistentry>
241         <term>quiet</term>
242         <listitem>
243           
244 <para>If non-zero, no "missing" message is emitted</para>
245
246         </listitem>
247       </varlistentry>
248     </variablelist>
249
250   </refsect1><refsect1><title>Returns</title>
251   
252 <para>Returns a string representing a section number.</para>
253 </refsect1></refentry>
254
255 <refentry xml:id="template.get.refentry.date">
256 <refnamediv>
257 <refname>get.refentry.date</refname>
258 <refpurpose>Gets date metadata for a refentry</refpurpose>
259 </refnamediv>
260 <refsynopsisdiv>
261 <synopsis>&lt;xsl:template name="get.refentry.date"&gt;
262 &lt;xsl:param name="refname"/&gt;
263 &lt;xsl:param name="info"/&gt;
264 &lt;xsl:param name="prefs"/&gt;
265   ...
266 &lt;/xsl:template&gt;</synopsis>
267 </refsynopsisdiv>
268 <refsect1><title>Description</title>
269     
270 <para>The <literal>man(7)</literal> man page describes this as "the
271     date of the last revision". If we cannot find a date in the source, we
272     generate one.</para>
273
274   </refsect1><refsect1><title>Parameters</title>
275     
276 <variablelist>
277       <varlistentry>
278         <term>refname</term>
279         <listitem>
280           
281 <para>The first <tag>refname</tag> in the refentry</para>
282
283         </listitem>
284       </varlistentry>
285       <varlistentry>
286         <term>info</term>
287         <listitem>
288           
289 <para>A set of info nodes (from a <tag>refentry</tag>
290           element and its ancestors)</para>
291
292         </listitem>
293       </varlistentry>
294       <varlistentry>
295         <term>prefs</term>
296         <listitem>
297           
298 <para>A node containing users preferences (from global stylesheet parameters)</para>
299
300         </listitem>
301       </varlistentry>
302     </variablelist>
303
304   </refsect1><refsect1><title>Returns</title>
305     
306 <para>Returns a <tag>date</tag> node.</para>
307
308   </refsect1></refentry>
309
310 <refentry xml:id="template.get.refentry.source">
311 <refnamediv>
312 <refname>get.refentry.source</refname>
313 <refpurpose>Gets source metadata for a refentry</refpurpose>
314 </refnamediv>
315 <refsynopsisdiv>
316 <synopsis>&lt;xsl:template name="get.refentry.source"&gt;
317 &lt;xsl:param name="refname"/&gt;
318 &lt;xsl:param name="info"/&gt;
319 &lt;xsl:param name="prefs"/&gt;
320   ...
321 &lt;/xsl:template&gt;</synopsis>
322 </refsynopsisdiv>
323 <refsect1><title>Description</title>
324     
325 <para>The <literal>man(7)</literal> man page describes this as "the
326     source of the command", and provides the following examples:
327     
328 <itemizedlist>
329       <listitem>
330         
331 <para>For binaries, use something like: GNU, NET-2, SLS
332         Distribution, MCC Distribution.</para>
333
334       </listitem>
335       <listitem>
336         
337 <para>For system calls, use the version of the kernel that you are
338         currently looking at: Linux 0.99.11.</para>
339
340       </listitem>
341       <listitem>
342         
343 <para>For library calls, use the source of the function: GNU, BSD
344         4.3, Linux DLL 4.4.1.</para>
345
346       </listitem>
347     </itemizedlist>
348
349     </para>
350
351
352     
353 <para>The <literal>solbook(5)</literal> man page describes
354     something very much like what <literal>man(7)</literal> calls
355     "source", except that <literal>solbook(5)</literal> names it
356     "software" and describes it like this:
357     <blockquote>
358       
359 <para>This is the name of the software product that the topic
360       discussed on the reference page belongs to. For example UNIX
361       commands are part of the <literal>SunOS x.x</literal>
362       release.</para>
363
364     </blockquote>
365     </para>
366
367
368     
369 <para>In practice, there are many pages that simply have a version
370     number in the "source" field. So, it looks like what we have is a
371     two-part field,
372     <replaceable>Name</replaceable> <replaceable>Version</replaceable>,
373     where:
374     
375 <variablelist>
376       <varlistentry>
377         <term>Name</term>
378         <listitem>
379           
380 <para>product name (e.g., BSD) or org. name (e.g., GNU)</para>
381
382         </listitem>
383       </varlistentry>
384       <varlistentry>
385         <term>Version</term>
386         <listitem>
387           
388 <para>version name</para>
389
390         </listitem>
391       </varlistentry>
392     </variablelist>
393
394     Each part is optional. If the <replaceable>Name</replaceable> is a
395     product name, then the <replaceable>Version</replaceable> is probably
396     the version of the product. Or there may be no
397     <replaceable>Name</replaceable>, in which case, if there is a
398     <replaceable>Version</replaceable>, it is probably the version of the
399     item itself, not the product it is part of. Or, if the
400     <replaceable>Name</replaceable> is an organization name, then there
401     probably will be no <replaceable>Version</replaceable>.
402     </para>
403
404   </refsect1><refsect1><title>Parameters</title>
405     
406 <variablelist>
407       <varlistentry>
408         <term>refname</term>
409         <listitem>
410           
411 <para>The first <tag>refname</tag> in the refentry</para>
412
413         </listitem>
414       </varlistentry>
415       <varlistentry>
416         <term>info</term>
417         <listitem>
418           
419 <para>A set of info nodes (from a <tag>refentry</tag>
420           element and its ancestors)</para>
421
422         </listitem>
423       </varlistentry>
424       <varlistentry>
425         <term>prefs</term>
426         <listitem>
427           
428 <para>A node containing users preferences (from global
429           stylesheet parameters)</para>
430
431         </listitem>
432       </varlistentry>
433     </variablelist>
434
435   </refsect1><refsect1><title>Returns</title>
436     
437 <para>Returns a <tag>source</tag> node.</para>
438
439   </refsect1></refentry>
440
441 <refentry xml:id="template.get.refentry.source.name">
442 <refnamediv>
443 <refname>get.refentry.source.name</refname>
444 <refpurpose>Gets source-name metadata for a refentry</refpurpose>
445 </refnamediv>
446 <refsynopsisdiv>
447 <synopsis>&lt;xsl:template name="get.refentry.source.name"&gt;
448 &lt;xsl:param name="refname"/&gt;
449 &lt;xsl:param name="info"/&gt;
450 &lt;xsl:param name="prefs"/&gt;
451   ...
452 &lt;/xsl:template&gt;</synopsis>
453 </refsynopsisdiv>
454 <refsect1><title>Description</title>
455     
456 <para>A "source name" is one part of a (potentially) two-part
457     <replaceable>Name</replaceable> <replaceable>Version</replaceable>
458     source field. For more details, see the documentation for the
459     <function>get.refentry.source</function> template.</para>
460
461   </refsect1><refsect1><title>Parameters</title>
462     
463 <variablelist>
464       <varlistentry>
465         <term>refname</term>
466         <listitem>
467           
468 <para>The first <tag>refname</tag> in the refentry</para>
469
470         </listitem>
471       </varlistentry>
472       <varlistentry>
473         <term>info</term>
474         <listitem>
475           
476 <para>A set of info nodes (from a <tag>refentry</tag>
477           element and its ancestors)</para>
478
479         </listitem>
480       </varlistentry>
481       <varlistentry>
482         <term>prefs</term>
483         <listitem>
484           
485 <para>A node containing users preferences (from global
486           stylesheet parameters)</para>
487
488         </listitem>
489       </varlistentry>
490     </variablelist>
491
492   </refsect1><refsect1><title>Returns</title>
493     
494 <para>Depending on what output method is used for the
495   current stylesheet, either returns a text node or possibly an element
496   node, containing "source name" data.</para>
497
498   </refsect1></refentry>
499
500 <refentry xml:id="template.get.refentry.version">
501 <refnamediv>
502 <refname>get.refentry.version</refname>
503 <refpurpose>Gets version metadata for a refentry</refpurpose>
504 </refnamediv>
505 <refsynopsisdiv>
506 <synopsis>&lt;xsl:template name="get.refentry.version"&gt;
507 &lt;xsl:param name="refname"/&gt;
508 &lt;xsl:param name="info"/&gt;
509 &lt;xsl:param name="prefs"/&gt;
510   ...
511 &lt;/xsl:template&gt;</synopsis>
512 </refsynopsisdiv>
513 <refsect1><title>Description</title>
514     
515 <para>A "version" is one part of a (potentially) two-part
516     <replaceable>Name</replaceable> <replaceable>Version</replaceable>
517     source field. For more details, see the documentation for the
518     <function>get.refentry.source</function> template.</para>
519
520   </refsect1><refsect1><title>Parameters</title>
521     
522 <variablelist>
523       <varlistentry>
524         <term>refname</term>
525         <listitem>
526           
527 <para>The first <tag>refname</tag> in the refentry</para>
528
529         </listitem>
530       </varlistentry>
531       <varlistentry>
532         <term>info</term>
533         <listitem>
534           
535 <para>A set of info nodes (from a <tag>refentry</tag>
536           element and its ancestors)</para>
537
538         </listitem>
539       </varlistentry>
540       <varlistentry>
541         <term>prefs</term>
542         <listitem>
543           
544 <para>A node containing users preferences (from global
545           stylesheet parameters)</para>
546
547         </listitem>
548       </varlistentry>
549     </variablelist>
550
551   </refsect1><refsect1><title>Returns</title>
552     
553 <para>Depending on what output method is used for the
554   current stylesheet, either returns a text node or possibly an element
555   node, containing "version" data.</para>
556
557   </refsect1></refentry>
558
559 <refentry xml:id="template.get.refentry.manual">
560 <refnamediv>
561 <refname>get.refentry.manual</refname>
562 <refpurpose>Gets source metadata for a refentry</refpurpose>
563 </refnamediv>
564 <refsynopsisdiv>
565 <synopsis>&lt;xsl:template name="get.refentry.manual"&gt;
566 &lt;xsl:param name="refname"/&gt;
567 &lt;xsl:param name="info"/&gt;
568 &lt;xsl:param name="prefs"/&gt;
569   ...
570 &lt;/xsl:template&gt;</synopsis>
571 </refsynopsisdiv>
572 <refsect1><title>Description</title>
573     
574 <para>The <literal>man(7)</literal> man page describes this as "the
575     title of the manual (e.g., <citetitle>Linux Programmer's
576     Manual</citetitle>)". Here are some examples from existing man pages:
577     
578 <itemizedlist>
579       <listitem>
580         
581 <para><citetitle>dpkg utilities</citetitle>
582         (<command>dpkg-name</command>)</para>
583
584       </listitem>
585       <listitem>
586         
587 <para><citetitle>User Contributed Perl Documentation</citetitle>
588         (<command>GET</command>)</para>
589
590       </listitem>
591       <listitem>
592         
593 <para><citetitle>GNU Development Tools</citetitle>
594         (<command>ld</command>)</para>
595
596       </listitem>
597       <listitem>
598         
599 <para><citetitle>Emperor Norton Utilities</citetitle>
600         (<command>ddate</command>)</para>
601
602       </listitem>
603       <listitem>
604         
605 <para><citetitle>Debian GNU/Linux manual</citetitle>
606         (<command>faked</command>)</para>
607
608       </listitem>
609       <listitem>
610         
611 <para><citetitle>GIMP Manual Pages</citetitle>
612         (<command>gimp</command>)</para>
613
614       </listitem>
615       <listitem>
616         
617 <para><citetitle>KDOC Documentation System</citetitle>
618         (<command>qt2kdoc</command>)</para>
619
620       </listitem>
621     </itemizedlist>
622
623     </para>
624
625
626     
627 <para>The <literal>solbook(5)</literal> man page describes
628     something very much like what <literal>man(7)</literal> calls
629     "manual", except that <literal>solbook(5)</literal> names it
630     "sectdesc" and describes it like this:
631     <blockquote>
632       
633 <para>This is the section title of the reference page; for
634       example <literal>User Commands</literal>.</para>
635
636     </blockquote>
637     </para>
638
639
640   </refsect1><refsect1><title>Parameters</title>
641     
642 <variablelist>
643       <varlistentry>
644         <term>refname</term>
645         <listitem>
646           
647 <para>The first <tag>refname</tag> in the refentry</para>
648
649         </listitem>
650       </varlistentry>
651       <varlistentry>
652         <term>info</term>
653         <listitem>
654           
655 <para>A set of info nodes (from a <tag>refentry</tag>
656           element and its ancestors)</para>
657
658         </listitem>
659       </varlistentry>
660       <varlistentry>
661         <term>prefs</term>
662         <listitem>
663           
664 <para>A node containing users preferences (from global
665           stylesheet parameters)</para>
666
667         </listitem>
668       </varlistentry>
669     </variablelist>
670
671   </refsect1><refsect1><title>Returns</title>
672     
673 <para>Returns a <tag>manual</tag> node.</para>
674
675   </refsect1></refentry>
676
677 <refentry xml:id="template.get.refentry.metadata.prefs">
678 <refnamediv>
679 <refname>get.refentry.metadata.prefs</refname>
680 <refpurpose>Gets user preferences for refentry metadata gathering</refpurpose>
681 </refnamediv>
682 <refsynopsisdiv>
683 <synopsis>&lt;xsl:template name="get.refentry.metadata.prefs"/&gt;</synopsis>
684 </refsynopsisdiv>
685 <refsect1><title>Description</title>
686     
687 <para>The DocBook XSL stylesheets include several user-configurable
688     global stylesheet parameters for controlling <tag>refentry</tag>
689     metadata gathering. Those parameters are not read directly by the
690     other <tag>refentry</tag> metadata-gathering
691     templates. Instead, they are read only by the
692     <function>get.refentry.metadata.prefs</function> template,
693     which assembles them into a structure that is then passed to
694     the other <tag>refentry</tag> metadata-gathering
695     templates.</para>
696
697
698     
699 <para>So the, <function>get.refentry.metadata.prefs</function>
700     template is the only interface to collecting stylesheet parameters for
701     controlling <tag>refentry</tag> metadata gathering.</para>
702
703   </refsect1><refsect1><title>Parameters</title>
704     
705 <para>There are no local parameters for this template; however, it
706     does rely on a number of global parameters.</para>
707
708   </refsect1><refsect1><title>Returns</title>
709     
710 <para>Returns a <tag>manual</tag> node.</para>
711
712   </refsect1></refentry>
713
714 <refentry xml:id="template.set.refentry.metadata">
715 <refnamediv>
716 <refname>set.refentry.metadata</refname>
717 <refpurpose>Sets content of a refentry metadata item</refpurpose>
718 </refnamediv>
719 <refsynopsisdiv>
720 <synopsis>&lt;xsl:template name="set.refentry.metadata"&gt;
721 &lt;xsl:param name="refname"/&gt;
722 &lt;xsl:param name="info"/&gt;
723 &lt;xsl:param name="contents"/&gt;
724 &lt;xsl:param name="context"/&gt;
725 &lt;xsl:param name="preferred"/&gt;
726   ...
727 &lt;/xsl:template&gt;</synopsis>
728 </refsynopsisdiv>
729 <refsect1><title>Description</title>
730     
731 <para>The <function>set.refentry.metadata</function> template is
732     called each time a suitable source element is found for a certain
733     metadata field.</para>
734
735   </refsect1><refsect1><title>Parameters</title>
736     
737 <variablelist>
738       <varlistentry>
739         <term>refname</term>
740         <listitem>
741           
742 <para>The first <tag>refname</tag> in the refentry</para>
743
744         </listitem>
745       </varlistentry>
746       <varlistentry>
747         <term>info</term>
748         <listitem>
749           
750 <para>A single *info node that contains the selected source element.</para>
751
752         </listitem>
753       </varlistentry>
754       <varlistentry>
755         <term>contents</term>
756         <listitem>
757           
758 <para>A node containing the selected source element.</para>
759
760         </listitem>
761       </varlistentry>
762       <varlistentry>
763         <term>context</term>
764         <listitem>
765           
766 <para>A string describing the metadata context in which the
767           <function>set.refentry.metadata</function> template was
768           called: either "date", "source", "version", or "manual".</para>
769
770         </listitem>
771       </varlistentry>
772     </variablelist>
773
774   </refsect1><refsect1><title>Returns</title>
775   
776 <para>Returns formatted contents of a selected source element.</para>
777 </refsect1></refentry>
778 </reference>