← Prev in month
← Prev in thread
firstterm and indexterm
Hi DocBook community!
When I use a <firstterm>, I generally want that term to end up in the
index. So I generally write something like:
<firstterm><indexterm><primary>foo</primary></indexterm>foo</firstterm>
(Sometimes I've put the indexterm after or before the firstterm instead,
but I think this is the best placement.)
This obviously gets rather long. So I think I will create a
preprossesing xslt transform to translate <firstterm>foo</firstterm> to
the above for me. The transform would work something:
<xsl:template match="firstterm[indexterm]">
<firstterm>
<xsl:apply-templates/><!-- pass through -->
</firstterm>
</xsl:template>
<xsl:template match="firstterm[@baseform]">
<firstterm>
<indexterm><primary>
<xsl:value-of select="@baseform"/>
</primary></indexterm>
<xsl:apply-templates/>
</firstterm>
</template>
<xsl:template match="firstterm">
<firstterm>
<indexterm><primary>
<xsl:value-of select="."/>
</primary></indexterm>
<xsl:apply-templates/>
</firstterm>
</template>
<!-- and a copy-everything rule for all other stuff -->
Would this be a good thing to do? Or would it be sematically bad in
some way?
--
Rasmus Kaj <>
← Prev in month
← Prev in thread