Search code examples
xmlcsl

Conditional statement for varying journal-specific style


I am working on customizing a citation style (CSL) for a specific annual conference journal. The existing citation style is generally correct, but the conference requires a specific and different style for their journal compared with all other journals. For example, the existing journal style provides the following for all journals:

Author, F., S. Author, and T. Author. Journal Article Title. Transportation Research Record: Journal of the Transportation Research Board, No. 9999, 2013, pp. 107–117.

while the conference requires the following style for their journal only:

Author, F., S. Author, and T. Author. Journal Article Title. In Transportation Research Record: Journal of the Transportation Research Board, No. 9999, Transportation Research Board of the National Academies, Washington, D.C., 2013, pp. 107–117.

My main question is: how do I alter the citation style for journals, but only when the title matches a specific journal title?

The general citation style for journals is shown below:

<else-if type="article-journal article-newspaper" match="any">
  <group delimiter=". ">
    <text macro="title"/>
    <group delimiter=", ">
      <text variable="container-title" font-style="italic" form="long"/>
      <text variable="volume" prefix="Vol. "/>
      <text variable="issue" prefix="No. "/>
      <text macro="issued"/>
      <text macro="page"/>
    </group>
  </group>
</else-if>

I am currently working on adding an else-if statement that selects type="article-journal", but also recognizes when the variable title="specific journal title" to incorporate the variations in the style requested by the conference. See below:

<else-if type="article-journal article-newspaper" match="any">
  <choose>
    <if match=".[title='specific journal title']">
      <!--   SPECIFIC JOURNAL CITATION   -->
    </if>
    <else>
      <!--   GENERAL JOURNAL CITATION   -->
    </else>
  </choose>
</else-if>

I believe this new code doesn't work because the match used isn't specified in csl, but I have seen examples in xml for using <when> and <otherwise> (which don't appear to be accepted by csl. How do I create a journal-specific formatting when a given citation requires a different format within the same 'type'?


Solution

  • Thanks for adding some examples. Based on your example for a Transportation Research Record paper, it doesn't look like a journal article at all, but more like a chapter, report, or conference paper. References for journal articles rarely print the publisher ("Transportation Research Board of the National Academies, Washington, D.C.") or use "In" before the publication title.

    I would try to change the item type of your TRR papers (to e.g. CSL's "chapter", "report", or "paper-conference", and see if one of those brings you closer to what you need. The current style in the CSL repository already defines formats for these three item types, by the way. And if you're using Zotero, see https://aurimasv.github.io/z2csl/typeMap.xml for a mapping between Zotero and CSL item types and fields.