collect all index terms from document
group index terms with the same initial letter
alphabetically sort terms inside each group
entries on the second level are processed in a similar way, and so on …
XSLT based implementation:
uses Muenchian method for grouping
the actual code is not very transparent
works only for English and few other Western European languages