docbook-apps

Applying emphasis to indexterms

  • 1.  Applying emphasis to indexterms

    Posted 03-12-2012 10:03
    I'm trying to ensure that any primary, secondary or tertiary entries in
    the indexterm element, and which have a nested emphasis element, are
    generated in the index with an italic font style. I'm using the basic
    indexing method with 1.76.1ns. I've tried to track the coding to
    customise, and from autoidx.xsl I thought that the template
    <xsl:templatematch="d:indexterm"mode="index-primary"> would be the most
    likely (I'm looking for an fo:block where the primary term is applied).

    Here is my customisation from that template:

    <xsl:for-eachselect="$refs/d:primary">
    <xsl:iftest="@id or @xml:id">
    <fo:inlineid="{(@id|@xml:id)[1]}"/>
    </xsl:if>
    </xsl:for-each>

    <xsl:choose>
    <xsl:whentest="d:emphasis">
    <fo:inlinefont-style="italic">
    <xsl:value-ofselect="d:primary"/>
    </fo:inline>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-ofselect="d:primary"/>
    </xsl:otherwise>
    </xsl:choose>

    ... and obviously not working (this template in my customisation -and
    seemingly any from autoidx - gives me error messages about variables not
    declared -- so it won't transform). Where do I need to customise?
    Typical markup in a chunk (to format primary entries with <emphasis>) is:

    <entry><indexterm>
    <primary><emphasis>European carp</emphasis></primary>
    <secondary>Cyprinus carpio</secondary>
    </indexterm>

    Where should I be looking so that <emphasis> is applied?

    --
    *Dave Gardiner*