SortingĀ : original-date vs date

Let's say your style contains this:
<sort>
<key macro="author"/>
<key variable="original-date"/>
<key variable="issued"/>
</sort>

That's not common at the moment because storing the original-date is a bit hackish. The issue is that items with an original date are sorted before those which don't have one, even if they are actually subsequent (reprinted) edition.
E.g:
Doe, Book, 12th ed., 2002 [1933], xx+1150 p.
Doe, Book, 1st ed., 1892, x+723 p.
Doe, Book, 2nd ed., 1893, xii+759 p.

The solution would be, for the purpose of sorting, to assume that the original-date of an item is its date, when nothing is stored in its original-date field.

What do you think of that?
  • I see the logic, but I'd rather not hardcode it into citeproc/the CSL specs since CSL is perfectly capable of doing this:

    <macro name="date-sort">
    <choose>
    <if variable="original-date">
    <date variable="original-date" form="numeric" date-parts="year"/>
    </if>
    <else>
    <date variable="issued" form="numeric" date-parts="year"/>
    </else>
    </choose>
    ...

    <sort>
    <key macro="author"/>
    <key macro="date-sort"/>
    </sort>
  • That's elegant, thanks!
Sign In or Register to comment.