This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Sorted Glossary (Solution)
- From: Stephan Wiesner <stephan at stephan-wiesner dot de>
- To: docbook-apps at lists dot oasis-open dot org
- Date: Sat, 14 Dec 2002 17:36:55 +0100
- Subject: DOCBOOK-APPS: Sorted Glossary (Solution)
Hi list,
Call me lazy, but I hate to group and sort my glossary. Therefore I just
put them into my document and use XSL to sort them.
Just in case anybody is interested, here it is.
Stephan
Example Glossentry:
<glossentry id="gloss_OpenPGP">
<glossterm id="gloss_OpenPGPT">OpenPGP</glossterm>
<glossdef><para>OpenPGP is the most widely used email encryption
standard in the world. It
is defined by the OpenPGP Working Group of the Internet Engineering
Task Force (IETF)
standard RFC 2440. The OpenPGP standard was originally derived from
PGP (Pretty Good
Privacy), first created by Phil Zimmermann in 1991.
</para>
<para>
The OpenPGP Alliance is a growing group of companies and other
organizations that
are implementers of the OpenPGP standard. The Alliance works to
facilitate technical
interoperability and marketing synergy between OpenPGP
implementations.
</para>
<para>See <ulink url="http://www.openpgp.org/" /> for details.</para>
</glossdef>
</glossentry>
The XSLT:
<xsl:template match="glossdef">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="glossary">
<fo:table width="17cm" table-layout="fixed"
border="0.0pt solid black"
text-align="left"
>
<fo:table-column column-width="3.5cm"/>
<fo:table-column column-width="13.5cm"/>
<fo:table-body>
<xsl:for-each select="glossentry" >
<xsl:sort select="glossterm | acronym"/>
<fo:table-row border="0.0pt solid black">
<fo:table-cell>
<fo:block vertical-align="middle" hyphenate="false">
<xsl:value-of select="glossterm" />
</fo:block>
<xsl:if test="acronym">
<fo:block>
(<xsl:value-of select="acronym" />)
</fo:block>
</xsl:if>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="justify">
<xsl:apply-templates select="glossdef" />
</fo:block>
</fo:table-cell>
</fo:table-row >
</xsl:for-each>
</fo:table-body>
</fo:table>
</xsl:template>