CSL - Choose - if date-part day is not null
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?
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?
This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.
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