A "wonder" about sorting
Hello,
Indeed, I'm just wondering why my script is working whereas the validator.nu says it shouldn't !!
I'm using CSL 1.0.1 with Zotero 3.0.14 and Firefox 19.0.
Here is the piece of code:
<sort>
<choose>
<if type="book article-journal chapter entry-encyclopedia paper-conference thesis" match="any">
<key macro="author"/>
<key variable="issued"/>
</if>
<else-if type="entry-dictionary">
<key variable="title"/>
<key variable="issued"/>
</else-if>
</choose>
</sort>
The errors logically come up from the fact I'm using "choose" as child element of "sort". I'm doing this because I need to sort the type "entry-dictionary" by "title" and the other types by "author" (yes, it's a very customized personal style !).
Any idea someone ?
Fred
Indeed, I'm just wondering why my script is working whereas the validator.nu says it shouldn't !!
I'm using CSL 1.0.1 with Zotero 3.0.14 and Firefox 19.0.
Here is the piece of code:
<sort>
<choose>
<if type="book article-journal chapter entry-encyclopedia paper-conference thesis" match="any">
<key macro="author"/>
<key variable="issued"/>
</if>
<else-if type="entry-dictionary">
<key variable="title"/>
<key variable="issued"/>
</else-if>
</choose>
</sort>
The errors logically come up from the fact I'm using "choose" as child element of "sort". I'm doing this because I need to sort the type "entry-dictionary" by "title" and the other types by "author" (yes, it's a very customized personal style !).
Any idea someone ?
Fred
<macro name="author-title-sort">
<choose>
<if type="book article-journal chapter
entry-encyclopedia paper-conference thesis"
match="any">
<text macro="author"/>
</if>
<else-if type="entry-dictionary">
<text variable="title"/>
</else-if>
</choose>
</macro>
<sort>
<key macro="author-title-sort"/>
<key variable="issued"/>
</sort>
Without a cs:else segment, though, this will place all item types not covered by your conditions (such as "interview") in a separate block, sorted by date. That's probably not what you want, so you might want to alter the conditional a bit.
The types here utilized in the condition should normally be the only ones I would have to handle. Otherwise, I will foresee a special treatment if I ever have a new type to deal with.
I'm gonna try your solution and let you know about the results.
Thanks !
Fred