You have a glossary with acronyms and you want to generate a sorted list of these acronyms automatically.
The following prerequisites are needed:
The element glossary
and for each
glossterm
your acronym as shown in the following
structure:
<glossary version="5.0" xmlns="http://docbook.org/ns/docbook"> <title>Acronym Test File</title> <info> <author> <personname> <firstname>Thomas</firstname> <surname>Schraitle</surname> </personname> </author> </info> <glossentry xml:id="xml"> <acronym>XML</acronym> <glossdef> <para>Lore ipsum</para> </glossdef> </glossentry> <glossentry xml:id="pdf"> <acronym>PDF</acronym> <glossdef> <para>Lore ipsum</para> </glossdef> </glossentry> <glossentry xml:id="oasis"> <acronym>OASIS</acronym> <glossdef> <para>Lore ipsum</para> </glossdef> </glossentry> <glossentry xml:id="dtd"> <acronym role="foo" xml:id="dtd-acronym">DTD</acronym> <glossdef> <para>Lore ipsum</para> </glossdef> </glossentry> </glossary>
The following stylesheet to apply it to your XML structure:
The result will look like this:
<!-- This file is dynamically generated at build time from a glossary file. To change this file, make changes to the appropriate glossary.xml file. In order to generate the acronyms file, any glossary entries with an acronym tag must have an xml:id. --> <appendix xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="acronyms"> <title>Acronyms</title> <para> This appendix displays acronyms sorted alphabetically and linked to their definition in the glossary. </para> <itemizedlist remap="glossary"> <listitem> <para> <acronym linkend="dtd-acronym" remap="acronym">DTD</acronym> </para> </listitem> <listitem> <para> <acronym linkend="oasis" remap="acronym">OASIS</acronym> </para> </listitem> <listitem> <para> <acronym linkend="pdf" remap="acronym">PDF</acronym> </para> </listitem> <listitem> <para> <acronym linkend="xml" remap="acronym">XML</acronym> </para> </listitem> </itemizedlist> </appendix>
TBD
Project@GitHub | Issue#8 |