Override the count-footnotes? function of the DSSSL print stylesheet

to fix a bug that would cause footnote numbering to be messed up if
using %footnote-ulinks% and we had any empty <ulink></ulink> elements
in a document.  (This happens a lot in the release documentation.)

This change has been submitted to the DocBook bug database on
SourceForge as bug #502066.  When it gets included into the
DocBook DSSSL distribution and the corrected version gets incorporated
into the FreeBSD Ports Collection, I'll back out the change in our
(FreeBSD's) stylesheet.
This commit is contained in:
Bruce A. Mah 2002-01-10 22:09:44 +00:00
parent ec07088979
commit 1f72c2c952
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=11664

View file

@ -427,6 +427,27 @@
(element (tertiaryie ulink)
(indexentry-link (current-node)))
;; Override the count-footnote? definition from dbblock.dsl
;; to fix a bug. Basically, the original procedure would count
;; all ulink elements when doing %footnote-ulinks%. It's
;; actually harder than that, because ulink elements with no
;; content shouldn't generate footnotes (the ulink element
;; definition just inserts the url attribute in-line, thus there
;; is no need for a footnote with the url). So, when we figure
;; out which footnotes to count for the purpose of determining
;; footnote numbers, we only count the ulink elements containing
;; content.
(define (count-footnote? footnote)
;; don't count footnotes in comments (unless you're showing comments)
;; or footnotes in tables which are handled locally in the table
(if (or (and (has-ancestor-member? footnote (list (normalize "comment")))
(not %show-comments%))
(has-ancestor-member? footnote (list (normalize "tgroup")))
(and (has-ancestor-member? footnote (list (normalize "ulink")))
(node-list-empty? (children footnote))))
#f
#t))
(element ulink
(make sequence
(if (node-list-empty? (children (current-node)))