Re: Bibliography support?

Subject: Re: Bibliography support?
From: Norman Walsh <ndw@xxxxxxxxxx>
Date: Mon, 31 Aug 1998 13:57:24 -0400
/ MARK.WROTH@xxxxxxxxxxx (Wroth, Mark) was heard to say:
| I *think* this is a DSSSL question, but maybe not -- general comments on
| the approach are welcome (desired, even).

What you outline sounds reasonable.  I'm assuming here that you
have one, monolithic bibliography at the end of the document,
not multiple bibliographies or bibliographies broken into parts.
(Either of those could be handled, but I'm not going to try to
off the top of my head ;-)

No promises that this is an efficient algorithm.

You didn't provide a DTD, so here's a source fragment, just for
ease of explanation:

  <doc>
    ... <cite id="foo"> <!-- that's really an IDREF, right? -->
    ... <cite id="bar">

  <bibliography>
    <bibentry id="foo">...</bibentry>
    <bibentry id="bar">...</bibentry>
    <bibentry id="baz">...</bibentry>
  </bibliography>
  </doc>
    
Put all the bibentys in the order in which you'd prefer them
to print.  In the code for bibliography,

 1. Grab all the CITE descendants from the entire document
 2. Grab all the BIBENTRY children of BIBLIOGRAPHY
 3. Write a function (bibentry-used bibid cite-list) that returns
    true iff the "bibid" specified occurs as a target in at least one  
    of the CITE elements in the cite-list.
 4. Write a loop something like this:

    (let loop ((bib-list bibentry-list) (used (empty-node-list)))
	(if (node-list-empty bib-list)
	    used
            (if (bibentry-used (attribute-string "ID") cite-list)
	        (loop (node-list-rest bib-list)
                      (node-list used (node-list-first bib-list)))
                (loop (node-list-rest bib-list) used))))

 5. Process the node list returned by that loop.

That should give you the cited bibliography entries, in order.

                                        Cheers,
                                          norm
-- 
Norman Walsh <ndw@xxxxxxxxxx>      | "Bother", said Pooh, as he deleted
http://nwalsh.com/                 | his root directory.


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • Bibliography support?
    • Wroth, Mark - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id NAA17370Mon, 31 Aug 1998 13:05:00 -0400 (EDT)
      • Norman Walsh - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id NAA19345Mon, 31 Aug 1998 13:59:12 -0400 (EDT) <=