1

Let's say that I have a reference such as:

title "Hello World"
urls
 - http://example.com/foo (accessed 20/03/2018)
 - http://example.com/bar (accessed 10/05/2015)

(And let's say that the above reference is processed into a form that a CSL processor can understand; citeproc-js in this case)

Does the CSL specification allow to produce a citation (from this only reference) that looks like this?

Hello World! http://example.com/foo (accessed 20/03/2018); http://example.com/bar (accessed 10/05/2015)

I know I could support one pair with this: (simplified style for the example)

<citation>
  <layout>
    <text variable="title" suffix=" "/>
    <group>
      <text variable="URL" suffix=" "/>
      <date variable="accessed" prefix="(" suffix=")">
        <date-part name="day" suffix="/"/>
        <date-part name="month" suffix="/"/>
        <date-part name="year"/>
      </date>
    </group>
  </layout>
</citation>

But how do I "iterate" over multiple pairs?

It doesn't seem that the CSL specification nor the schema for CSL data support this. Am I wrong?

customcommander
  • 17,580
  • 5
  • 58
  • 84
  • 1
    Correct, CSL doesn't support multiple values for standard variables (only for names) - they take a single string, so the data you have in your YAML is invalid for CSL purposes. FWIW, this has never come up as a request in the history of CSL. From a citation perspective, these should just be two separate citations. – adam.smith Mar 05 '20 at 02:51
  • @adam.smith Could it also be two cites (i.e. from two separate references) in one citation? – customcommander Mar 05 '20 at 05:59

1 Answers1

1

You can do this with two citations, e.g.:

- type: webpage
  URL:  http://example.com/foo (accessed 20/03/2018)
- type: webpage
  URL:  http://example.com/bar (accessed 10/05/2015)

Style snippet

<citation>
  <layout delimiter="; ">
    <group>
      <text variable="URL" suffix=" "/>
      <date variable="accessed" prefix="(" suffix=")">
        <date-part name="day" suffix="/"/>
        <date-part name="month" suffix="/"/>
        <date-part name="year"/>
      </date>
    </group>
  </layout>
</citation>

And then simply include "Hello World!" in the text. Note the delimiter in layout that determines how the two elements are separated.

adam.smith
  • 808
  • 4
  • 9
  • 1
    Just want to make sure I understand the spec semantics: Given two references, this would produce one citation made of two cites (each cite refers to one reference only), right? – customcommander Mar 05 '20 at 13:07
  • 1
    That's exactly right, yes: "The cs:citation element describes the formatting of citations, which consist of one or more references (“cites”) to bibliographic sources." – adam.smith Mar 05 '20 at 17:40