Conditional style if only DOI is present

Hi,
Choosing with
<if type="book">
...
</if>
seems straight forward to me.

Now I would like to add an output style to the bibliography which kicks in
if a DOI is given and no page numbers are present.

How can I achieve this?
  • <if variable="DOI">
    ...
    </if>
  • Thanks Adam,
    how about the page numbers?
    I would like to have the style invoked for anything that has a DOI.
    However if the reference also provides page numbers it should use the normal style.
    <if hasPageNumbers> <!-- Problem is here --/>
    </if>
    <elseif>
    <if variable="DOI">
    <!-- Applying the appropriate format --/>
    </if>
    </elseif>

    Maybe there is a different way to invoke this as well (via a type for instance).
  • edited October 3, 2009
    That might actually happen automatically - try it out -
    I think the "Include URL" option (in the style panel of the preferences) pertains to DOIs as well.
    If not, you can just do

    <if variable="page"> (note this is "page" not pages)


    <else-if variable="DOI">

    <else>
    That should work - not 100% sure, but I think I got that right.

    Otherwise you will have to include the <if variable ="DOI"> in the else loop of the <if variable="page">

    Edit: Bruce, the creator of CSL tells us to use if type as little as possible and find other ways. Clearly, you can use it as necessary - and for common types such as book, book-chaper, article-journal etc. that is unproblematic, but other types might change.
  • Works like a charm!
    Thank you for the help
    I believe that DOI and page should be stable for the future as well.
    Specific types like thesis and book-section or ?-chapter? ...
    I fear might have to be reconsidered in the future.

    I hope to finish the style other the weekend.
    How can I deposit it?
  • depositing:
    if you expect this to be your only style, just post it somewhere -
    e.g on gist.github.com (just paste and post by clicking the past button) and I'll post for you)
    If you think you may be contributing more in the future I'll walk you through getting an svn account and submitting through that - it's not hard to do, but a bit of a hassle and certainly not worth it if you'll only be committing one or two styles.
  • Thanks Adam,
    no need for yet another SVN account or gist... account
    I will only occasionally create a style.
    In cases where I publish in a journal where the style is not already available.
    Here the style for Amino Acids:
    http://www.allmer.de/jens/index.php?dirInd=3
    Not sure if you want to directly include it since I think I have to get back to the editor about possible inconsistencies in their required format for the bibliography.
    I will update the xml accordingly.

    PS: Happy to experience that the Zotero forum is active and very helpful
  • OK, I'll keep an eye on this and upload it when you give me green light.

    I recommend gist.github.com btw. because you don't need an account to post there - (you only need an account if you start an entire project on github.) - and you can see the code before downloading it - but obviously the above will do.
  • OK - I've uploaded these styles to the new csl 1.0 at https://github.com/citation-style-language/styles and will eventually move to citationstyles.org
    The parent style is called Springer Author Date, the amino styles are uploaded as dependents. Thanks for contributing.
Sign In or Register to comment.