Subject: Creating index headers
From: Manne Miettinen <manne.miettinen@xxxxxx>
Date: 29 Jan 2002 10:49:36 +0200
|
Hi there,
I have a glossary of scientific terms in xml that contains entries like this:
<entry type='n'>
<term>A term</term>
<treq>Finnish translation equivalen</treq>
<def>Definition(s) of the term</def>
... some other fields omitted
</entry>
I would like to create html-version of the glossary where all the entries would
be sorted alphabetically using the content of term-element as sort key. For each
new beginning letter I would like to produce a header and anchor like this:
<h2>A</h2>
<a name=a"/>
<dl>
<dt type="term">A term</dt>
<dt type="treq">Finnish translation equivalent</dt>
<dd>Definitions of the term</dd>
<h2>B</h2>
...
My first cut at the problem was creating a variable for each letter in the
alphabet, like this
<xsl:variable name="a" select="/glossary/entry[substring(term,1,1)='a']|entry[substring(term, 1,1)='A']"/>
<xsl:variable name="b" select="/glossary/entry[substring(term,1,1)='b']|entry[substring(term, 1,1)='B']"/>
However the glossary contains also numbers and symbols (, +, α, β etc
that I would like to lump under a common heading of "Numbers and symbols".
Any suggestions?
--
Manne MIETTINEN manne.miettinen@xxxxxx
CSC - Scientific Computing Ltd. +358 9 457 2517 (Tel)
PO BOX 405 +358 50 381 9510 (GSM)
FIN 02101 Espoo, FINLAND +358 9 457 2302 (Fax)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|