Testing variable value

I'm developing a citation style for my group's internal wiki. Everything is pretty much working but I can't seem to figure out how write a conditional based on the value of a variable.

For instance, for all articles from "arXiv", I want the page number to be formatted like this:
[[arxiv>page #]].

I figure it is probably something like:
<choose>
<if container-title="arXiv" match="any">
<text variable="page" prefix="[[arxiv>" suffix="]]"/>
</if>
</choose>

but that doesn't seem to work.

Is there any way to do this?

Forgive me if this is obvious.

Thanks for your help
  • edited September 18, 2009
    not obvious and afaik not possible at the moment.
    You can only test for a type, the presence of a variable (i.e. if variable="container-title"), as well as conditions like position, disambiguate, and locator.
    Can't think of a good solution to this, either.
  • Doh..

    Oh well, I'll roll with what I have. Having to manually edit the citation later isn't that big of a deal.

    thanks for your help!
  • Why do you want the page numbers formatted differently?
  • Because the wiki will automatically link to the article. For articles with a DOI, the wiki syntax:

    [[doi>DOI]] will automatically provide the link: http://dx.doi.org/DOI

    Articles on arXiv don't have DOIs but you can link to them by article number and the wiki is setup to resolve:
    [[arxiv>article #]] to http://arxiv.org/abs/article #

    I have been storing the article # in the pages field in Zotero.
  • So you're wanting to copy-and-paste fully formatted citations into the wiki but then have that into the wiki?

    Can you point me to an example?

    Also, what wiki software?
  • The software is dokuwiki. I've modified the interwiki linking ability to do the resolving that I described above, so now it is specific to our site.

    As for Zotero, I've modified the Chicago Manual of Style style-file to return what I want based on DOI. Now I can drag and drop from zotero straight into the wiki and have it formatted how I want:

    * Baek, Minnhagen, Bernhardsson, Choi, and Kim. "Flow improvement caused by agents who ignore traffic rules." Physical Review E (Statistical, Nonlinear, and Soft Matter Physics) **80** 1: 016111-5 (2009). [[DOI>10.1103/PhysRevE.80.016111]].

    While articles from arXiv come out like:
    * Bazant, Kilic, Storey, and Ajdari. "Towards an understanding of nonlinear electrokinetics at large applied voltages in concentrated solutions." arXiv: 0903.4790 (2009).

    but I'd like them to come out as:
    * Bazant, Kilic, Storey, and Ajdari. "Towards an understanding of nonlinear electrokinetics at large applied voltages in concentrated solutions." arXiv: 0903.4790 (2009) [[arxiv>0903.4790]].
  • I think the only way to automate would be to store the arXiv value in another field that you are not using for anything else (repository?)
    then doing an
    if value="DOI" ... else "repository" ...
    type statement.
    I've done something similar for creating links in a rough html style giving priority to a DOI link, or if no DOI, using a URL.
  • just to avoid confusion (I know komrade knows this)
    it would be

    if variable="DOI"...
    /if
    else-if variable="archive"
    /else-if

    the problem with these hacks, of course, is that people would have to insert the arXiv manually into there references, which is a little besides the point - especially since we don't have batch editing yet -
    with batch editing this would be easy.
  • bump.

    Is there any chance progress has been made?

    I would also like to create a conditional

    <if container-title="...">


    then...


    Thanks!
  • Testing for the text content of variables is not supported in CSL, and it is unlikely to be implemented. If you can describe your scenario, people may have suggestions for how to go about producing the output you are after.
  • I'm writing a style for the Journal of Instrumentation (JINST). The instructions require citations for articles to be of the form:

    Author, Title, Journal Volume (Year) Pages

    But for articles published in JINST and a few others from that family (JHEP, JCAP, JSTAT) the format is

    Author, Title, Year Journal Volume Pages

    Thanks
  • edited April 2, 2013
    There's not a lot you can do for that in the short term. We have the same problem in the law, where the form of citation differs depending on whether the year is treated as a primary volume number. The respective cites in that case look like thisStreet v Mountford, [1985] 2 Weekly Law Reports 877 (HL).
    Barrett v. Enfield L.B.C., (1999) 49 B.M.L.R. 1 (HL).

    Discriminating between the two forms is not possible in Zotero currently. For legal support, Multilingual Zotero has implemented a "Year as Vol." field (mapping to the CSL collection-number variable), which allows us to pull it off.

    If you post your use case to the Changes to Fields and Item Types thread, there is a fair chance that the "Year as Vol." field (or some other solution to the problem) will make it into Zotero 4.1.
  • Oh well. It was worth a try.

    I'll see what I can post in Changes to Fields and Item Types.

    Thanks for the help!
  • I have a similar problem with reports. The general format is

    Author [...] Place published: Publisher.

    For a certain type the format should instead be

    Author [...] Publisher.

    Is it possible?
  • No, sorry. Other than using a different item type (like manuscript) or testing for the presence of some variable (say number or genre) I don't see many options there.
Sign In or Register to comment.