Self made citation style sorts on index number while defined as author-date
Hi,
I have made a CSL file and almost everything is working. There is just one small mystery that I haven't been able to solve. My CSL style refuses to sort on author / date, it sorts on index number while I did not configure it like that. My bibliography tag contains:
<sort>
<key macro="author"/>
<key macro="year-date"/>
</sort>
the header has this tag: <category term="author-date"/>
and author is defined as:
<macro name="author">
<names variable="author">
<name name-as-sort-order="all" and="text" sort-separator=", " initialize-with=". " delimiter=", " delimiter-precedes-last="always"/>
</names>
</macro>
and year-date as:
<macro name="year-date">
<choose>
<if variable="issued">
<date variable="issued">
<date-part name="year"/>
</date>
</if>
<else>
<text term="no date"/>
</else>
</choose>
</macro>
i am sure it's something simple, your help is much appreciated!
best regards,
Diederik
I have made a CSL file and almost everything is working. There is just one small mystery that I haven't been able to solve. My CSL style refuses to sort on author / date, it sorts on index number while I did not configure it like that. My bibliography tag contains:
<sort>
<key macro="author"/>
<key macro="year-date"/>
</sort>
the header has this tag: <category term="author-date"/>
and author is defined as:
<macro name="author">
<names variable="author">
<name name-as-sort-order="all" and="text" sort-separator=", " initialize-with=". " delimiter=", " delimiter-precedes-last="always"/>
</names>
</macro>
and year-date as:
<macro name="year-date">
<choose>
<if variable="issued">
<date variable="issued">
<date-part name="year"/>
</date>
</if>
<else>
<text term="no date"/>
</else>
</choose>
</macro>
i am sure it's something simple, your help is much appreciated!
best regards,
Diederik
That makes it easier than to paste it to the forum.
thanks for you help.
OK, first big problem is that your file is not valid; there are dozens of errors. Fix those problems and you might find it magically works as you expect.
http://www.zotero.org/support/dev/creating_citation_styles
My XML validator (RNV) gives about 30 errors, one of which is that you put the sort-instructions inside the layout of the bibliography. Still, as bdarcus said, fixing that still leaves you with a crippled style that won't work reliably unless all the other errors have been fixed.
Most errors were because the online generator added form="", I removed those and the sort was at the wrong spot, I fixed that and now it works. There were also some errors because of variable names, but I am not sure why that would throw an error. For example, the validation scheme chokes on:
<option name="disambiguate-add-year" value="true"/>
<option name="disambiguate-add-givename" value="true"/>
but I have seen these options in many reference styles.
I don't have the original csl file as generated.....
thanks for your help!
See also:
http://www.zotero.org/support/dev/csl_syntax_summary#citation_only_options
I'll guess the author of the generator will also have to be notified of some problems with producing valid styles.