HTML presentation of bibliography as in JabRef via CSL


a client wanted a large bibliography as html table in order to show it on their site. After trying out other strategies, I used parts of a script by Mark Schenk used in JabRef, and wrote a CSL style that exports the data in html markup language. For the initial problems I had with conflict characters ( " and ' for html and js commands) I found a solution: The output of the CSL I pass through a macro in oo_writer that replaces conflict characters as follows:

" signs found in the Zotero data: & #34; (without the space between & and #)
' signs found in the Zotero data: & #39; (without the space between & and #)
|| replace by " (the CSL produces || for what I want to be a " in the html)
\ replace by ' (the CSL produces \ for what I want to be a ' in the html)

A sample entry as exported by my CSL:

<tr class="entry"><td>2010</td><td>Hurch, Bernhard</td><td><b>Wilhelm von Humboldt: Schriften zur Anthropologie der Basken</b></td><td>Guillermo de Humboldt: Obras a cerca de la antropología de los Vascos</td><td><small>LING HIST</small></td><td>monografía</td><td>Paderborn: Schöningh </td><td><a href="">URL</a> </td><td> </td>

The abstract is displayed as tooltip mouseover, using "wz_tooltip.js" by Walter Zorn ( ). It is there where ' signs cause conflicts.

Another problem was that tags cannot be exported via CSL. So I put the tags I wanted to be displayed in a free data field (I chose "archive_location").

The "extra" field I used for the translated "title", which was what the client wanted.

You find the CSL here:

And here you see the result:
  • CSL is not really the tool that I'd use for this job. In fact I glued together some stuff to do this kind of job with some third party libraries (unfortunately not working in Firefox 3.6 yet, use 3.5x). Source code and instructions available at:
  • If you just need one-time export, an export translator can do this more flexibility than CSL and less complexity than a local server, with the one major drawback of not being able to call the CSL processor to format the bibliography entries (although that's something that could probably be changed).

    For any serious automatic generation, two-way access, of use of CSL styles, however, Kieren's approach allows for maximum flexibility and extensibility.
  • edited April 18, 2010
    The citeproc-js processor will encode all quotation marks and apostrophes in output as open- and close-quote characters expressed as ascii-escaped numeric unicode entities, so when it debuts in Zotero, that will solve that end of the encoding issue. The new processor will support rich text markup in fields, though, which means HTML tags in titles and the like; for use in rollovers, you would need to define an output format that encodes or strips them. (Or fashion the rollovers in CSS?)

    If you want to have style formatting capability in a page, the processor itself could be run in the browser window on client side. It runs cross-browser (as of yesterday), with confirmed success against the demo page with IE6 and up, Google Chrome, and Gecko-based browsers including Firefox.

    So many possibilities ...
Sign In or Register to comment.