Zotero export to plain (html) table?


I work (on linux) on a large bibliography, and I'm really happy with Zotero. My problem ist that I am asked to deliver a plain html file with a table in it. At the moment I use Zotero's Bibtex export, open it with JabRef and use JabRef's .sxc/.ods/.html export feature. Things that get lost are: Author/Contributor/Translator classification of the name and some other fields like "Extra" or "Repository". Any idea?

Thanks in advance, hippiecore
  • not sure what the "table in it" means so maybe this is totally off -
    but Zotero has a html export (Create Bib from Selected Items -> html)
  • OK, the Zotero html export creates no table. With table I mean a table like an excel sheet (.ods or .sxc in open office) or a table inside word or open office, that could afterwards be sorted manually, e.g. by year of publication.

    The foundation I work for wants plain tables like this:


    I'd have to include several more fields from Zotero, at least the tags and the "extra" field, where I store the basque translation of the item's title.

    Furthermore, the Zotero html doesn't reproduce the weblinks properly (cuts them before the last dot) and it doesn't reproduce all the fields.
  • ah - OK - no, there's definitely no simple way of doing that. (I think a .csv export option would be cool to have).
    And getting the additional fields in - I'd guess you'd have to modify the bibtex export?
  • edited September 17, 2009
    It is possible and quite easy to change the CSL to do this for you. Are you comfortable doing some very basic coding?
    (it's really just a little cut and paste, and changing a few tiny parts)

    You can put the HTML tags in as suffix and prefix of each part, and you can chose the order of the elements within the bibilography.

    The rough version I made is posted here:

    And you are very welcome to modify for your purposes. It should work OK - you will need to move some of the fields around, and you might not want the links attached to titles (though they are useful).

    Note it gives an error message about the XML when installed (due to the html tags), but it still works fine.

    There are some beginners instructions on changing the CSL here, with links on to further information:

    I also used the same technique to just put a comma between each field, and so make a CSV format, which can therefore be opened in a spreadsheet easily.

    Hope this helps!
  • oooh - cool komrade - these are great!
    Unfortunately not tags this way - csl can't call them (the extra field is "note" for csl I believe).
  • I can post the CSV version tomorrow if you like (on other computer) - though it's pretty easy to make it for yourself...
  • Thanks for your help, komrade & adamsmith. I just started with the csl tutorial, I'll learn that some day, also for changing the style I use most (DIN).

    Komrade, nice if you post your style for csv! That would be the best for me, I'd open it with oo_calc.
  • ...your htmlo1 style is refused when installing (because of the xml error), install fails in my zotero.
  • in any case the style doesn't produce a table, just formatted citations
    (komrade: you can actually validate that style - you had forgotten a date-part in one point and you can change all the html <> to & lt; and &gt ; (without the space)

    but hippiecore is right - the csv would be great! Happy to help you tweak details on that one, too - it would seem hard to get it to put the commas for missing fields (you'd want ,, where a field is missing, right?)
  • CSL isn't really designed for outputting customized markup. And yeah, the example isn't even valid XML (you need to escape the markup).
  • which example are you referring to? Komrade's code? My code?

    And I understand that csl isn't ideal for this, but javascript is actually hard to learn and those two are the only ways I know to get data out of zotero - better than nothing.
  • @Komrade's

    Yes, JS isn't idea;. Am just wondering if their might be other options; like some simpler template-based example such as XSLT. If I were going this, I'd rum the XHTML report output through an XSLT.
  • edited September 17, 2009
    Yes I mentioned above that my example gave errors - i.e. wasn't valid -
    but it does put out html perfectly for my purpose.

    My point was simply to demonstrate an example that could very easily be modified for what hippiecore needs. I understand that CSL is not designed for this, but in the absence of a real CSV export or customisable html, it has saved me alot of effort and given me exactly what I need for now.

    e.g. if hippiecore edits my example:
    change: <p> and </p>
    to: <tr> and </tr>
    and change (or add to) the other tags <em>X</em> and <a>X</a>
    to make them <td>X</td>

    and move or add a few fields into the appropriate order, you should start to get exactly what you need.

    My CSV export is also quick-and-dirty - and just uses a custom no-date term for missing fields which I just removed with a search-and-replace once it's into excel.
    Again, a fairly dirty hack, but is giving me direct export into exactly the form I want in a spreadsheet, so in the absence of something better...
  • komrade - sounds good - I think the CSV output would still be great to have in any case. I'd even suggest putting that on the repository once it's a bit polished.
    I never written much html (beyond <blockquote> :-) ) so this is far from obvious to me, but sounds great.
  • Yes, it could probably be polished up and put on the repository - I imagine people would find it useful.
    To be more generally applicable, it will probably need lots of individual macros to separate out each element of each item type, and have a null option for each one.

    And is there a way to output the "type" of item in CSL? (i.e. thesis, book etc.). I think you came across this issue with the new MLA style?
  • edited September 17, 2009
    My point was simply to demonstrate an example that could very easily be modified for what hippiecore needs. I understand that CSL is not designed for this, but in the absence of a real CSV export or customisable html, it has saved me alot of effort and given me exactly what I need for now.
    My point was just to say this isn't a very good general solution, and that Zotero might consider something better (so that it's easier for people in the future).
  • edited September 18, 2009
    Fully agreed. CSV export is probably the only thing I ever miss about endnote.
  • komrade - unfortunately I faked it for MLA: while csl has "medium" zotero doesn't map to that. For MLA I just distinguished between print and web by using
    <if variable="URL">...
  • Here's my CSV version for now.

    It's still an alpha draft - there's lots of column matching errors if you mix multiple types.
    If you do just journal articles or just books it should work OK.
    (you can just do them in a few batches)

    For obvious reasons, if you have a comma in the title (or anywhere else) it wont work!

    To work better this should probably be coded from scratch using this concept
    (i.e. lots of "if-content else-null" macros)
    But I haven't got time to fiddle right now - got a PhD to write...

    Ideally of course Zotero devs would create a CSV output which just exports the entire database, instead of messy hacks to the csl.
  • edited September 18, 2009
    If I were going this, I'd rum the XHTML report output through an XSLT.
    I know you're eager, but "Talk Like a Pirate Day" is still a day away:
  • Gee, this is way cool. I now realize that I could write my own CSL to output custom bibliographies for the web. With the HTML markup I want. Not that I have the time to do so. And I agree with Bruce that XSLT would be the more correct way to do it.
  • Wonderful komrade! Your csv script at


    gives excellent results. I just changed all "," delimiters to "%", as that character doesn't appear in the data, and I can import it without any problem to oo_calc.

    Now I have to find out a way to include the missing fields.
  • An old question... I thought I'd post a link to a program I put together that produces an interactive HTML bibliography from a set of Zotero collections:


    It comes with a Wordpress connector, but runs independently as well (producing HTML).

    I hope this is helpful to people finding this thread.
  • cool. Added to the list here: http://www.zotero.org/support/plugins?&#website_integration (feel free to move it to the WordPress category if you think that is a better fit.)
Sign In or Register to comment.