[xsl] How to suppress vertical whitespace from <indexterm>

Subject: [xsl] How to suppress vertical whitespace from <indexterm>
From: "Jeffrey Walton noloader@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Mar 2018 23:14:31 -0000
Hi Everyone,

I have a DocBook v4.5 book at
https://github.com/noloader/POWER8-crypto . I am use Ubuntu 16.04
with:

    $ xsltproc --version
    Using libxml 20903, libxslt 10128 and libexslt 817
    xsltproc was compiled against libxml 20903, libxslt 10128 and libexslt 817
    libxslt 10128 was compiled against libxml 20903
    libexslt 817 was compiled against libxml 20903

I use this pattern shown below to generate index entries.
(https://github.com/noloader/POWER8-crypto/blob/master/power8-crypto/ch01.xml#L45)
.

The problem is, the <indexterm> creates extra vertical whitespace
wherever it is present. For example, ch01.xml#L45 (link above) has:

    The book makes frequent references to... <end of paragraph>.
        <indexterm>
        <indexterm>
        <indexterm>
    Both POWER8 machines are IBM POWER System S822 ... <end of paragraph>.

And it produces:

    The book makes frequent references to... <end of paragraph>.
        <whitespace>
        <whitespace>
        <whitespace>
    Both POWER8 machines are IBM POWER System S822 ... <end of paragraph>.

I understand there is space between paragraphs, and I expect "normal"
spacing as if the <indexterm> were not present:

    The book makes frequent references to... <end of paragraph>.
        <whitespace>
    Both POWER8 machines are IBM POWER System S822 ... <end of paragraph>.

I am using this script to build the book:
https://github.com/noloader/POWER8-crypto/blob/master/power8-crypto/make-book.sh
. It is pretty boring and just calls:

    XSL=/usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl
    xsltproc --xinclude "$XSL" book.xml > power8-crypto.fo

My question is, how can I collapse the extra wheitespace into a single
whitespace?

I'm happy to use an xsltproc option to clooapse the whitespace. I am
also happy to use sed or awk to remove them.

Thank you in advance. And my apologies for the long post.

****************************************

Here is a typical application of the <indexterm> pattern.

<para>The book makes frequent references to
<systemitem>gcc112</systemitem> and <systemitem>gcc119</systemitem>
from the GCC Compile Farm...</para>
<indexterm>
<primary>Compile farm</primary>
<secondary>gcc112</secondary>
</indexterm>
<indexterm>
<primary>Compile farm</primary>
<secondary>gcc119</secondary>
</indexterm>
<indexterm>
<primary>Compile farm</primary>
<secondary>POWER8</secondary>
</indexterm>
<para>Both POWER8 machines are IBM POWER System S822 with two CPU
cards...</para>

Current Thread