doc: Fix "Prev" link, take 2.

Commit 6678b58d78 fixed a wrong "Prev" link by changing the link
generation code to use [position()=last()] instead of [last()] in
the predicate on the union of reverse axes.  Unfortunately, that
caused documentation builds to take much longer.  To fix, combine
the "preceding" and "ancestor" steps into one "preceding" step and
one "ancestor" step, and revert the predicate back to [last()].
The smaller union evades the libxml2 bug while avoiding the build
time regression.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Tested-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1132496.1781718007%40sss.pgh.pa.us
Backpatch-through: 14
This commit is contained in:
Nathan Bossart 2026-06-18 09:31:27 -05:00
parent 39e649d44a
commit 1fec5ddfdc

View file

@ -183,32 +183,32 @@
</xsl:if>
<xsl:variable name="prev"
select="(preceding::book[1]
|preceding::preface[1]
|preceding::chapter[1]
|preceding::appendix[1]
|preceding::part[1]
|preceding::reference[1]
|preceding::refentry[1]
|preceding::colophon[1]
|preceding::article[1]
|preceding::topic[1]
|preceding::bibliography[parent::article or parent::book or parent::part][1]
|preceding::glossary[parent::article or parent::book or parent::part][1]
|preceding::index[$generate.index != 0]
[parent::article or parent::book or parent::part][1]
|preceding::setindex[$generate.index != 0][1]
|ancestor::set
|ancestor::book[1]
|ancestor::preface[1]
|ancestor::chapter[1]
|ancestor::appendix[1]
|ancestor::part[1]
|ancestor::reference[1]
|ancestor::article[1]
|ancestor::topic[1]
|preceding::sect1[1]
|ancestor::sect1[1])[position()=last()]"/>
select="(preceding::*[self::book
or self::preface
or self::chapter
or self::appendix
or self::part
or self::reference
or self::refentry
or self::colophon
or self::article
or self::topic
or self::sect1
or self::bibliography[parent::article or parent::book or parent::part]
or self ::glossary[parent::article or parent::book or parent::part]
or self::index[$generate.index != 0]
[parent::article or parent::book or parent::part]
or self::setindex[$generate.index != 0]][1]
|ancestor::*[self::set
or self::book
or self::preface
or self::chapter
or self::appendix
or self::part
or self::reference
or self::article
or self::topic
or self::sect1][1])[last()]"/>
<xsl:variable name="next"
select="(following::book[1]