Style sheets: fix docbook-xsl bug in autoidx

The template named generate-basic-index in
{docbook-xsl}/xhtml/autoidx.xsl has a bug that generates a div element
with a wrong xmlns:xlink attribute. See
https://github.com/docbook/xslt10-stylesheets/issues/239.
Rather than fixing docbook-xsl, which would work only in LFS (but we
want to be able to render on other distros), copy the faulty template
to our customization files (lfs-index.xsl), so that this one is used.
We can also simplify it a lot since we don't need all the cases
covered in general docbook-xsl.
This commit is contained in:
Pierre Labastie 2024-01-17 14:41:09 +01:00
parent 8ba840f34a
commit d5fda0bce5

View File

@ -24,6 +24,28 @@
<xsl:text>longindex.html</xsl:text>
</xsl:template>
<!-- The original template in {docbook-xsl}/xhtml/autoidx.xsl has
a bug that generates a <div> with a wrong xmlns:xlink attribute,
so copy it here (and simplify it a lot)-->
<xsl:template name="generate-basic-index">
<xsl:param name="scope" select="NOTANODE"/>
<xsl:variable name="terms" select="//indexterm
[count(.|key('letter',
translate(substring(&primary;, 1, 1),
&lowercase;,
&uppercase;
)
) [&scope;][1]) = 1]"/>
<div class="index">
<xsl:apply-templates select="$terms" mode="index-div-basic">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</div>
</xsl:template>
<!-- Divisions:
Override the default division titles, translating them from the default
'A', 'B', etc. to 'Packages', 'Programs', etc.