Sort order original date and issued combined?

Is there a way to sort the bibliography, so that the year given in issued is used, unless an original date is given, in which case this gets priority?

Currently I can only get it to sort either or.
  • What style are you working with?
  • My own. That's what I need the sorting for.
  • edited June 24, 2017
    In the bibliography sort section of the style, you can list multiple sorting keys. The bibliography will be sorted using the key order as the priority.

    So, for example:
    <sort>
    <key variable="original-date" sort="ascending"/>
    <key variable="issued" sort="ascending"/>
    <key macro="author"/>
    <key macro="title"/>
    </sort>

    will sort first by original date, then by issued, then by author, then by title.

    If that's not exactly what you want, then create a macro earlier in the style:
    <macro name="issued-sort">
    <choose>
    <if variable="original-date" match="any">
    <date variable="original-date">
    <date-part name="year"/>
    </date>
    </if>
    <else>
    <date variable="issued">
    <date-part name="year"/>
    </date>
    </else>
    </choose>
    </macro>


    and sort on that macro:
    <sort>
    <key macro="issued-sort" sort="ascending"/>
    <key macro="author"/>
    <key macro="title"/>
    </sort>


    If you have any other questions, it is easiest if you post the code for your style is a Private Gist here: http://gist.github.com and post a link.
  • Before I put this into the style: Will this sort the following items:

    Bachmann 1925 – Alberto Bachmann: An Encyclopedia of the Violin [1925], Reprint, New York, London 1966.
    Bachmann 1906 – Alberto Bachmann: Le violon (Lutherie-œuvres-biographies). Guide à l’usage des artistes & des amateurs. Avec une préface de Henry Gauthier-Villars., Paris 1906.
    Bachmann 1913 – Alberto Bachmann: Les grands violinistes du passé, Paris 1913.

    like this, or in the correct order? I have several sort keys already, but currently it will sort any items which have an original date entry before any other items of the same author name. This is not what I am after, I need them to sort with Bachmann 1925 as last item.

    Thanks!
  • Okay, do it with the "issued-sort" macro I gave above and remove the keys that use the date variables directly.
Sign In or Register to comment.