This one is a simple question, I think.
I’m looking at sort_BibliographyDescendingViaCompositeMacro. Its sort specification is as follows:
<sort>
<key variable="title" sort="descending"/>
<key macro="citation-number" sort="descending"/>
</sort>
Where the citation-number
macro is in effect a wrapper for the citation-number
variable. The expected output is
<div class="csl-bib-body">
<div class="csl-entry">[4] Aaaa</div>
<div class="csl-entry">[3] Bbbb</div>
<div class="csl-entry">[2] Xxxx</div>
<div class="csl-entry">[1] Zzzz</div>
</div>
I don’t understand why; in fact this seems backwards to me. The first sort key is a straightforward sort on the title
variable, descending. That, I would expect, should result in an order of “zzzz” to “aaaa”. There’s nothing left unsorted, so nothing for the secondary sort on citation-number
to do. The expected result seems to assume that the sorts would run in the reverse of the order I thought they did.
(If it helps, per the spec, emphasis added)
Sort keys are evaluated in sequence. A primary sort is performed on all items using the first sort key. A secondary sort, using the second sort key, is applied to items sharing the first sort key value. A tertiary sort, using the third sort key, is applied to items sharing the first and second sort key values. Sorting continues until either the order of all items is fixed, or until the sort keys are exhausted. Items with an empty sort key value are placed at the end of the sort, both for ascending and descending sorts.
Since there are no items here sharing the first sort-key value, the secondary sort shouldn’t happen, and it certainly shouldn’t reverse the order of the first one. Should the order of the sort-keys be reversed in the csl here?
(Or am I just confused about ascending and descending? It always confuses me, because we think of going “down” the alphabet from A-Z … but I think in conventional computer terms that’s ascending, as ASCII chars “go up” from A?)