Bob Stayton wrote:

> The tricky part is determining which letters actually have entries in
> the current index, so you don't create bookmark links to non-existant
> index sections.  I don't have a quick solution for that one.

I think that code from autoidx.xsl can be reused, namely from
generate-basic-template. For example following code will populate
variable $alphabetical with exactly one indexterm for each letter.

  <xsl:variable name="terms"
                select="//indexterm
                        [count(.|key('letter',
                          translate(substring(&primary;, 1, 1),
                             &lowercase;,
                             &uppercase;))
                          [&scope;][1]) = 1
                          and not(@class = 'endofrange')]"/>

  <xsl:variable name="alphabetical"
                select="$terms[contains(concat(&lowercase;, &uppercase;),
                                        substring(&primary;, 1, 1))]"/>

So in order to get just letters something like the following code could
be used:

<xsl:for-each select="$alphabetical">
  <rx:bookmark-label>
    <xsl:value-of select="substring(&primary;, 1, 1)"/
  </rx:bookmark-label>
</xsl:for-each>

                                Jirka

-- 
------------------------------------------------------------------
  Jirka Kosek      e-mail: ji...@kosek.cz      http://xmlguru.cz
------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to