Issue with CSL for DOI accessed date [solved]

edited January 24, 2024
Dear all,
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 full file can be found here: https://github.com/yin-ori/open-research/blob/main/ioa-template.csl
  • edited January 22, 2024
    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 (which, frankly, is a bit of a silly requirement for DOIs, which are meant to be stable).
    You also want to make sure to change the style ID, otherwise your style will get overwritten by the standard APA style regularly https://www.zotero.org/support/dev/citation_styles/style_editing_step-by-step#change_the_style_title_and_id.


    Edit: actually, as written, you're explicitly not including the access date when there is a URL -- 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. 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>
  • Hey Adam,
    thank you for your reply

    I have changed it to your macro, however it will still show the doi , but not the accessed date for some reason. Do you have any idea why that could still be the case?
  • Do you have the include URL box checked?
  • Yes and the URL (doi) itself does show, just the access part doesn’t for doi (for normal url it does).
  • can you link to your current version of the style? This should work
  • sorry was able to solve it! had a typo in one line!
Sign In or Register to comment.