CSL - Choose - if date-part day is not null

edited April 27, 2020
I would like to show the month in which the article was issued if and only if we also include the day.

Usually, I would go with something like <if variable="issued">. The problem is that I want to check just the date-part "day", not the whole "issued" variable.

But it is not possible to use the following:
        <date variable="issued">
          <choose>
            <if date-part="day">
              <date-part name="day" suffix=". "/>
              <date-part name="month" suffix=". " form="numeric"/>
            </if>
          </choose>
          <date-part name="year"/>
        </date>

And this does not work either:
        <choose>
          <if date-part="day">
            <date variable="issued">
              <date-part name="day" suffix=". "/>
              <date-part name="month" suffix=". " form="numeric"/>
              <date-part name="year"/>
            </date>
          </if>
          <else>
            <date variable="issued">
              <date-part name="year"/>
            </date>
          </else>
        </choose>


What is the proper way to check if the date-part "day" is not null?
  • You can't currently, sorry. It's on our list of things that we'd like CSL to be able to do, but may still be a bit out.
  • While you can't do this with the official CSL you can use the extended CSL version CSL-M.

    CSL-M has a condition <if has-day="issued">
    (Note: you might need to change the style version to "1.1mlz1". Also, Zotero will tell you that your style is invalid when you install it. But it will nevertheless work.)

    More infos, see https://citeproc-js.readthedocs.io/en/latest/csl-m/index.html
Sign In or Register to comment.