xmlcitationscsl

CSL for Zotero Citations


I am attempting to formulate my bibliography in Zotero to meet the requirements of my faculty's library. It is a Vancouver style with the following format:

Citation: (number)

Reference Authors (Surname, Initial). Title. Abbreviated journal name. numeric year;Volume number(issue number):pages [Accessed: numeric day.month.year] DOI or URL.

I am having difficulty with producing the year issued and having the date accessed be in the day.month.year format.

I am also unable to have the URL display only if the DOI is not present.

I tried to add the following:

<date variable=”issued”>
 <date-part name="day"/>
 <date-part name="month" form="numeric" strip-periods="true"/> 
 <date-part name="year"/>

with the plan of adding accessed but I keep returning an error

Thank you for any help.


Solution

  • For year issued:

    <date variable="issued" form="numeric" date-part="year"/>
    

    For date accessed, your code snippet has two issues: you're using curly quotes and you're missing the final tag. Corrected you'd have

    <date variable="accessed">
     <date-part name="day" suffix="."/>
     <date-part name="month" form="numeric" suffix="."/> 
     <date-part name="year"/>
    </date>
    

    Finally, for the DOI/URL logic, you'd want something like

    <choose>
      <if variable="DOI">
        <text variable="DOI" prefix="https://doi.org/"/>
      </if>
      <else if variable="URL">
        <group delimiter=": " prefix="[" suffix="]">
          <text term="accessed" text-case="capitalize-first"/>
          <date variable="accessed">
            <date-part name="day" suffix="."/>
            <date-part name="month" form="numeric" suffix="."/> 
            <date-part name="year"/>
          </date>
        </group>
        <text variable="URL" prefix=" "/>
      </else-if>
    </choose>
     
    

    (FWIW, you're likely to get help faster for CSL on the Zotero forums)