CSL file (Zotero) issue with accessed attribute for DOI

25 views Asked by At

I have tried to customize the APA csl file to fit my institute's style sheet. However, I am having a hard time to understand why my macro for accessed date is not working properly for DOI (but it does work for URL). The DOI itself will be printed, but not with access date.

The MWE for my access macro:

<macro name="access">
    <choose>
      <if variable="DOI" match="any">
        <text variable="DOI" prefix="https://doi.org/"/>
      </if>
      <else-if variable="URL">
        <text variable="URL" suffix=" "/>
        <group delimiter=" " prefix="(" suffix=")">
          <text term="retrieved" suffix=":"/>
          <date variable="accessed" form="numeric"/>
        </group>
      </else-if>
    </choose>
  </macro>

The full file can be found here: https://github.com/yin-ori/open-research/blob/main/ioa-template.csl

1

There are 1 answers

0
adam.smith On

Already answered over at Zotero, but again here for completeness's sake: There are actually two reasons the access date isn't appearing for DOIs:

  1. As written, you're explicitly not including the access date when there is a DOI -- as the original APA style does, you're first testing for the DOI, if that's present, print it with the https://doi.org/ prefix, and only when you don't have a DOI you're printing. Instead, you'll want something like:
    <macro name="access">
        <choose>
          <if variable="DOI" match="any">
            <text variable="DOI" prefix="https://doi.org/"/>
          </if>
          <else-if variable="URL">
            <text variable="URL"/>
          </else-if> 
        </choose>
        <group delimiter=" " prefix=" (" suffix=")">
          <text term="retrieved" suffix=":"/>
          <date variable="accessed" form="numeric"/>
        </group>
      </macro>
  1. Moreover, accessed date and URL are treated as null for articles with a page range unless you check the "Include URL" box in the Cite tab of the Zotero preferences. With that box checked, you should get the access date with the above code (which, frankly, is a bit of a silly requirement for DOIs, which are meant to be stable).

Finally, and unrelated to the access date, you also want to make sure to change the style ID, otherwise your style will get overwritten by the standard APA style regularly.