glossary.collection.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <refentry xmlns="http://docbook.org/ns/docbook"
  2. xmlns:xlink="http://www.w3.org/1999/xlink"
  3. xmlns:xi="http://www.w3.org/2001/XInclude"
  4. xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
  5. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  6. version="5.0" xml:id="glossary.collection">
  7. <refmeta>
  8. <refentrytitle>glossary.collection</refentrytitle>
  9. <refmiscinfo class="other" otherclass="datatype">string</refmiscinfo>
  10. </refmeta>
  11. <refnamediv>
  12. <refname>glossary.collection</refname>
  13. <refpurpose>Name of the glossary collection file</refpurpose>
  14. </refnamediv>
  15. <refsynopsisdiv>
  16. <src:fragment xml:id="glossary.collection.frag">
  17. <xsl:param name="glossary.collection"></xsl:param>
  18. </src:fragment>
  19. </refsynopsisdiv>
  20. <refsection><info><title>Description</title></info>
  21. <para>Glossaries maintained independently across a set of documents
  22. are likely to become inconsistent unless considerable effort is
  23. expended to keep them in sync. It makes much more sense, usually, to
  24. store all of the glossary entries in a single place and simply
  25. <quote>extract</quote> the ones you need in each document.</para>
  26. <para>That's the purpose of the
  27. <parameter>glossary.collection</parameter> parameter. To setup a global
  28. glossary <quote>database</quote>, follow these steps:</para>
  29. <refsection><info><title>Setting Up the Glossary Database</title></info>
  30. <para>First, create a stand-alone glossary document that contains all of
  31. the entries that you wish to reference. Make sure that each glossary
  32. entry has an ID.</para>
  33. <para>Here's an example glossary:</para>
  34. <informalexample>
  35. <programlisting>
  36. &lt;?xml version="1.0" encoding="utf-8"?&gt;
  37. &lt;!DOCTYPE glossary
  38. PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  39. "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"&gt;
  40. &lt;glossary&gt;
  41. &lt;glossaryinfo&gt;
  42. &lt;editor&gt;&lt;firstname&gt;Eric&lt;/firstname&gt;&lt;surname&gt;Raymond&lt;/surname&gt;&lt;/editor&gt;
  43. &lt;title&gt;Jargon File 4.2.3 (abridged)&lt;/title&gt;
  44. &lt;releaseinfo&gt;Just some test data&lt;/releaseinfo&gt;
  45. &lt;/glossaryinfo&gt;
  46. &lt;glossdiv&gt;&lt;title&gt;0&lt;/title&gt;
  47. &lt;glossentry&gt;
  48. &lt;glossterm&gt;0&lt;/glossterm&gt;
  49. &lt;glossdef&gt;
  50. &lt;para&gt;Numeric zero, as opposed to the letter `O' (the 15th letter of
  51. the English alphabet). In their unmodified forms they look a lot
  52. alike, and various kluges invented to make them visually distinct have
  53. compounded the confusion. If your zero is center-dotted and letter-O
  54. is not, or if letter-O looks almost rectangular but zero looks more
  55. like an American football stood on end (or the reverse), you're
  56. probably looking at a modern character display (though the dotted zero
  57. seems to have originated as an option on IBM 3270 controllers). If
  58. your zero is slashed but letter-O is not, you're probably looking at
  59. an old-style ASCII graphic set descended from the default typewheel on
  60. the venerable ASR-33 Teletype (Scandinavians, for whom /O is a letter,
  61. curse this arrangement). (Interestingly, the slashed zero long
  62. predates computers; Florian Cajori's monumental "A History of
  63. Mathematical Notations" notes that it was used in the twelfth and
  64. thirteenth centuries.) If letter-O has a slash across it and the zero
  65. does not, your display is tuned for a very old convention used at IBM
  66. and a few other early mainframe makers (Scandinavians curse &lt;emphasis&gt;this&lt;/emphasis&gt;
  67. arrangement even more, because it means two of their letters collide).
  68. Some Burroughs/Unisys equipment displays a zero with a &lt;emphasis&gt;reversed&lt;/emphasis&gt;
  69. slash. Old CDC computers rendered letter O as an unbroken oval and 0
  70. as an oval broken at upper right and lower left. And yet another
  71. convention common on early line printers left zero unornamented but
  72. added a tail or hook to the letter-O so that it resembled an inverted
  73. Q or cursive capital letter-O (this was endorsed by a draft ANSI
  74. standard for how to draw ASCII characters, but the final standard
  75. changed the distinguisher to a tick-mark in the upper-left corner).
  76. Are we sufficiently confused yet?&lt;/para&gt;
  77. &lt;/glossdef&gt;
  78. &lt;/glossentry&gt;
  79. &lt;glossentry&gt;
  80. &lt;glossterm&gt;1TBS&lt;/glossterm&gt;
  81. &lt;glossdef&gt;
  82. &lt;para role="accidence"&gt;
  83. &lt;phrase role="pronounce"&gt;&lt;/phrase&gt;
  84. &lt;phrase role="partsofspeach"&gt;n&lt;/phrase&gt;
  85. &lt;/para&gt;
  86. &lt;para&gt;The "One True Brace Style"&lt;/para&gt;
  87. &lt;glossseealso&gt;indent style&lt;/glossseealso&gt;
  88. &lt;/glossdef&gt;
  89. &lt;/glossentry&gt;
  90. &lt;!-- ... --&gt;
  91. &lt;/glossdiv&gt;
  92. &lt;!-- ... --&gt;
  93. &lt;/glossary&gt;</programlisting>
  94. </informalexample>
  95. </refsection>
  96. <refsection><info><title>Marking Up Glossary Terms</title></info>
  97. <para>That takes care of the glossary database, now you have to get the entries
  98. into your document. Unlike bibliography entries, which can be empty, creating
  99. <quote>placeholder</quote> glossary entries would be very tedious. So instead,
  100. support for <parameter>glossary.collection</parameter> relies on implicit linking.</para>
  101. <para>In your source document, simply use <tag>firstterm</tag> and
  102. <tag>glossterm</tag> to identify the terms you wish to have included
  103. in the glossary. The stylesheets assume that you will either set the
  104. <tag class="attribute">baseform</tag> attribute correctly, or that the
  105. content of the element exactly matches a term in your glossary.</para>
  106. <para>If you're using a <parameter>glossary.collection</parameter>, don't
  107. make explicit links on the terms in your document.</para>
  108. <para>So, in your document, you might write things like this:</para>
  109. <informalexample>
  110. <programlisting>&lt;para&gt;This is dummy text, without any real meaning.
  111. The point is simply to reference glossary terms like &lt;glossterm&gt;0&lt;/glossterm&gt;
  112. and the &lt;firstterm baseform="1TBS"&gt;One True Brace Style (1TBS)&lt;/firstterm&gt;.
  113. The &lt;glossterm&gt;1TBS&lt;/glossterm&gt;, as you can probably imagine, is a nearly
  114. religious issue.&lt;/para&gt;</programlisting>
  115. </informalexample>
  116. <para>If you set the <parameter>firstterm.only.link</parameter> parameter,
  117. only the terms marked with <tag>firstterm</tag> will be links.
  118. Otherwise, all the terms will be linked.</para>
  119. </refsection>
  120. <refsection><info><title>Marking Up the Glossary</title></info>
  121. <para>The glossary itself has to be identified for the stylesheets. For lack
  122. of a better choice, the <tag class="attribute">role</tag> is used.
  123. To identify the glossary as the target for automatic processing, set
  124. the role to <quote><literal>auto</literal></quote>. The title of this
  125. glossary (and any other information from the <tag>glossaryinfo</tag>
  126. that's rendered by your stylesheet) will be displayed, but the entries will
  127. come from the database.
  128. </para>
  129. <para>Unfortunately, the glossary can't be empty, so you must put in
  130. at least one <tag>glossentry</tag>. The content of this entry
  131. is irrelevant, it will not be rendered:</para>
  132. <informalexample>
  133. <programlisting>&lt;glossary role="auto"&gt;
  134. &lt;glossentry&gt;
  135. &lt;glossterm&gt;Irrelevant&lt;/glossterm&gt;
  136. &lt;glossdef&gt;
  137. &lt;para&gt;If you can see this, the document was processed incorrectly. Use
  138. the &lt;parameter&gt;glossary.collection&lt;/parameter&gt; parameter.&lt;/para&gt;
  139. &lt;/glossdef&gt;
  140. &lt;/glossentry&gt;
  141. &lt;/glossary&gt;</programlisting>
  142. </informalexample>
  143. <para>What about glossary divisions? If your glossary database has glossary
  144. divisions <emphasis>and</emphasis> your automatic glossary contains at least
  145. one <tag>glossdiv</tag>, the automic glossary will have divisions.
  146. If the <tag>glossdiv</tag> is missing from either location, no divisions
  147. will be rendered.</para>
  148. <para>Glossary entries (and divisions, if appropriate) in the glossary will
  149. occur in precisely the order they occur in your database.</para>
  150. </refsection>
  151. <refsection><info><title>Formatting the Document</title></info>
  152. <para>Finally, when you are ready to format your document, simply set the
  153. <parameter>glossary.collection</parameter> parameter (in either a
  154. customization layer or directly through your processor's interface) to
  155. point to your global glossary.</para>
  156. <para>A relative path in the parameter is interpreted in one
  157. of two ways:</para>
  158. <orderedlist numeration="loweralpha">
  159. <listitem>
  160. <para>If the parameter <literal>glossterm.auto.link</literal>
  161. is set to zero, then the path is relative to the file containing
  162. the empty <tag>glossary</tag> element in the document.</para>
  163. </listitem>
  164. <listitem>
  165. <para>If the parameter <literal>glossterm.auto.link</literal>
  166. is set to non-zero, then the path is relative to the file containing
  167. the first inline <tag>glossterm</tag> or
  168. <tag>firstterm</tag> in the document to be linked.</para>
  169. </listitem>
  170. </orderedlist>
  171. <para>Once the collection file is opened by the first instance described
  172. above, it stays open for the current document
  173. and the relative path is not reinterpreted again.</para>
  174. <para>The stylesheets will format the glossary in your document as if
  175. all of the entries implicilty referenced appeared there literally.</para>
  176. </refsection>
  177. <refsection><info><title>Limitations</title></info>
  178. <para>Glossary cross-references <emphasis>within the glossary</emphasis> are
  179. not supported. For example, this <emphasis>will not</emphasis> work:</para>
  180. <informalexample>
  181. <programlisting>&lt;glossentry&gt;
  182. &lt;glossterm&gt;gloss-1&lt;/glossterm&gt;
  183. &lt;glossdef&gt;&lt;para&gt;A description that references &lt;glossterm&gt;gloss-2&lt;/glossterm&gt;.&lt;/para&gt;
  184. &lt;glossseealso&gt;gloss-2&lt;/glossseealso&gt;
  185. &lt;/glossdef&gt;
  186. &lt;/glossentry&gt;</programlisting>
  187. </informalexample>
  188. <para>If you put glossary cross-references in your glossary that way,
  189. you'll get the cryptic error: <computeroutput>Warning:
  190. glossary.collection specified, but there are 0 automatic
  191. glossaries</computeroutput>.</para>
  192. <para>Instead, you must do two things:</para>
  193. <orderedlist>
  194. <listitem>
  195. <para>Markup your glossary using <tag>glossseealso</tag>:</para>
  196. <informalexample>
  197. <programlisting>&lt;glossentry&gt;
  198. &lt;glossterm&gt;gloss-1&lt;/glossterm&gt;
  199. &lt;glossdef&gt;&lt;para&gt;A description that references &lt;glossterm&gt;gloss-2&lt;/glossterm&gt;.&lt;/para&gt;
  200. &lt;glossseealso&gt;gloss-2&lt;/glossseealso&gt;
  201. &lt;/glossdef&gt;
  202. &lt;/glossentry&gt;</programlisting>
  203. </informalexample>
  204. </listitem>
  205. <listitem>
  206. <para>Make sure there is at least one <tag>glossterm</tag> reference to
  207. <glossterm>gloss-2</glossterm> <emphasis>in your document</emphasis>. The
  208. easiest way to do that is probably within a <tag>remark</tag> in your
  209. automatic glossary:</para>
  210. <informalexample>
  211. <programlisting>&lt;glossary role="auto"&gt;
  212. &lt;remark&gt;Make sure there's a reference to &lt;glossterm&gt;gloss-2&lt;/glossterm&gt;.&lt;/remark&gt;
  213. &lt;glossentry&gt;
  214. &lt;glossterm&gt;Irrelevant&lt;/glossterm&gt;
  215. &lt;glossdef&gt;
  216. &lt;para&gt;If you can see this, the document was processed incorrectly. Use
  217. the &lt;parameter&gt;glossary.collection&lt;/parameter&gt; parameter.&lt;/para&gt;
  218. &lt;/glossdef&gt;
  219. &lt;/glossentry&gt;
  220. &lt;/glossary&gt;</programlisting>
  221. </informalexample>
  222. </listitem>
  223. </orderedlist>
  224. </refsection>
  225. </refsection>
  226. </refentry>