Add report month and day to end of citation

Hi there,

I've tweaked the Springer-Basic (author-date, no "et al.") CSL style to what I need, but the last thing I'm hoping you guys can help me figure out is how/if I can include the month and day at the very end of the bibliographic entry for any Report (or just the month if only that is provided). For example "February 2" or "February"

I see how Zotero recognizes when you enter M D Y in the Date field, so I'm hoping I can have the CSL use that information.
  • You would need to add an additional ‘date’ element to the CSL style and include only the month and day date-parts. You can look at Chicago style for an example (which does this for magazines and newspapers).
  • edited May 13, 2021
    I've tried a couple different approaches and none of them work. I found a macro in the Chicago style, which I tried to replicate in my code, but the macro wasn't accepted for some reason. (I tried to show code here the comment box but it doesn't show up; I don't know how to make pictures show up either)

    <macro name="month-day"/>
    <date variable="issued">
    <date-part name="month"/>
    <date-part name="day" prefix=" "/>
    </date>
    </macro>

    When attempting this using the visual editor, it will only let me choose a format that includes the year (year-month-day, year-month, or year) for the date-parts, which is not what I want.

    I also tried adding this portion of the macro straight in to where I wanted it to show up and it was also rejected.

    <date variable="issued">
    <date-part name="month"/>
    <date-part name="day" prefix=" "/>
    </date>

    I'm at the end of my rope in things to try. I read the CSL Specifications on date but I'm guessing I'm not understanding a higher-level context here.
  • Update - I figured out I have to add an additional node on Date to get the date-part.
  • Nevermind again - I still can't get it to leave the year out. What should I do?
  • Could you put your code between <code> and </code> tags so it shows up?
  • Updated my previous comment with those tags

  • <date variable="issued">
    <date-part name="month"/>
    <date-part name="day" prefix=" "/>
    </date>

    This is exactly right -- if that doesn't work, you likely put it somewhere "illegal" (e.g. between a choose and an if element or so)
  • Before you spend too much time on this, just put your whole code somewhere we can look at it (pastebin.com e.g.) and we'll likely be able to tell you what's not right yet.
    Also try validator.citationstyles.org/ which can be helpful in spotting XML errors
  • Thanks for your help.

    I did put it between a choose and an if element. I figured I was doing something wrong like that. I don't know where else to put this type of info.

    To reiterate, I want Reports to include the month and year at the very end of the citation ("February 5"), or just the month ("February"), if that info is present in the Zotero date field.

    The pastebin URL for my code is https://pastebin.com/Pykb5MGV
  • So that doesn't happen for every item type, define a separate condition for reports. So find this:
    <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
    <group delimiter=", " prefix=". " suffix=".">
    <text variable="publisher"/>
    <text variable="publisher-place"/>
    </group>
    </else-if>


    And change it to two separate conditions:
    <else-if type="bill book graphic legal_case legislation motion_picture song" match="any">
    <group delimiter=", " prefix=". " suffix=".">
    <text variable="publisher"/>
    <text variable="publisher-place"/>
    </group>
    </else-if>
    <else-if type="report" match="any">
    <group delimiter=", " prefix=". " suffix=".">
    <text variable="publisher"/>
    <text variable="publisher-place"/>
    <date variable="issued">
    <date-part name="month"/>
    <date-part name="day" prefix=" "/>
    </date>
    </group>
    </else-if>
  • IT WORKED!!!!

    I did not have the confidence to edit that much code, so I was trying to make it fit in a place that it obviously didn't belong.

    Thank you so much :)
  • I have now discovered my custom style does not include Report Number or Report Type (which I understand is "number" and "genre" in CSL) for Reports. I know APA 7th edition includes this info, but I see that APA is a very complex style, so I'm guessing that's not a good place to find code I can pull off.

    Any suggestions?
  • You can just add something like
    <group delimiter=" ">
    <text variable="genre"/>
    <text variable="number"/>
    </group>


    To the custom report section above, likely right before publisher.
  • It worked - and wasn't near as painful as I thought it would be. Thank you!
Sign In or Register to comment.