How to show "no date" if there is no publication date entered?
Dear all,
I need some little help with the creation of an own citation style for my dissertation. Everything works fine, but there must be a single little error:
In case there is no publication date entered for e.g. a book, I would like that for the citation that "no date" is printed out, for example:
If there is a date given:
Müller, Hans (2007): The difficulties in working with CSL. Munich.
If there is no date entered:
Müller, Hans (no date): The difficulties in working with CSL. Munich.
My citation style below has included everything so that it should work, but it never prints "no date". In case of no publication place entered, it prints out "no place", exactly how I would like that it is. I hope that you can help me or describe which error I made. Thank you!
Link to the citation style:
http://www.microhealthinsurance-africa.org/fileadmin/user_upload/gerald/gerald-zitierstil-v15.csl
I need some little help with the creation of an own citation style for my dissertation. Everything works fine, but there must be a single little error:
In case there is no publication date entered for e.g. a book, I would like that for the citation that "no date" is printed out, for example:
If there is a date given:
Müller, Hans (2007): The difficulties in working with CSL. Munich.
If there is no date entered:
Müller, Hans (no date): The difficulties in working with CSL. Munich.
My citation style below has included everything so that it should work, but it never prints "no date". In case of no publication place entered, it prints out "no place", exactly how I would like that it is. I hope that you can help me or describe which error I made. Thank you!
Link to the citation style:
http://www.microhealthinsurance-africa.org/fileadmin/user_upload/gerald/gerald-zitierstil-v15.csl
I've pasted below the output of validation
- see here: http://www.zotero.org/support/dev/creating_citation_styles#xml_validation -
- the only validator isn't hard to use, you should probably learn how to do that yourself, it's quite helpful
#
Error: Bad value no place for attribute name on element term from namespace http://purl.org/net/xbiblio/csl.
From line 20, column 7; to line 20, column 40
rm>↩ <term name="no place" form="long">no pla
#
Error: Bad value long for attribute form on element date-part from namespace http://purl.org/net/xbiblio/csl.
From line 83, column 4; to line 83, column 60
="/"/>↩ <date-part name="day" form="long" prefix="/" suffix=")"/>↩ </da
#
Error: Bad value no place for attribute term on element text from namespace http://purl.org/net/xbiblio/csl.
From line 123, column 2; to line 123, column 24
<else>↩ <text term="no place"/>↩
#
Error: Bad value long for attribute form on element date-part from namespace http://purl.org/net/xbiblio/csl.
From line 134, column 4; to line 134, column 49
="/"/>↩ <date-part name="day" form="long" prefix="/"/>↩ </da
#
Error: Required children missing from element date from namespace http://purl.org/net/xbiblio/csl.
From line 139, column 2; to line 139, column 8
issued">↩ </date>↩
#
Error: Bad value long for attribute form on element date-part from namespace http://purl.org/net/xbiblio/csl.
From line 145, column 4; to line 145, column 49
="/"/>↩ <date-part name="day" form="long" prefix="/"/>↩ </da
#
Error: Bad value . In: for attribute term on element text from namespace http://purl.org/net/xbiblio/csl.
From line 237, column 3; to line 237, column 56
ainer">↩ <text term=". In:" text-case="lowercase" prefix=", "/>↩ <gr
#
Error: Bad value . In: for attribute term on element text from namespace http://purl.org/net/xbiblio/csl.
From line 318, column 6; to line 318, column 59
er">↩ <text term=". In:" text-case="lowercase" prefix=", "/>↩
What do you mean by ""no place" doesn't exist". I thought I created it with the syntax: <term name="no place" form="long">no place</term>?! Or is it necessary to create it as a variable?
<text value="no place"/>
Here is the macro year-date:
<macro name="year-date">
<group prefix="">
<choose>
<if variable="issued">
<date variable="issued">
<date-part name="year"/>
</date>
</if>
<else>
<text term="no date"/>
</else>
</choose>
</group>
</macro>
-----------
And here is the relevant biblio layout:
<bibliography>
<option name="hanging-indent" value="true"/>
<option name="et-al-min" value="4"/>
<option name="et-al-use-first" value="1"/>
<option name="subsequent-author-substitute" value="---"/>
<option name="entry-spacing" value="1"/>
<sort>
<key macro="author"/>
<key macro="year-date" sort="descending"/>
</sort>
<layout suffix=".">
<text macro="author" suffix=" "/>
<text macro="year-date" prefix=" (" suffix=")"/>
<choose>
<if type="report">
....
You also probably want to re-define the "no date" term to sin fecha in the beginning.
Btw. I think it's really awesome that CEPAL is switching to/recommending Zotero... but then I'm the type of person who gets goosebumps looking into the Sala Raul Prebisch. Are the crazy peacocks still around?
Please let me know whether adamsmith's advice works. If it works, that's probably the best solution.
My solution:
I managed to get "no place" and "no date" only, if removed them from the <macro> section and put it in the <citation> section. There it worked without any problem. The only drawback is that I had to copy the syntax to three locations in <citation>, which might be not the greatest programming style. Anyway, it works for me.
I started using Zotero for my own work at Cepal, and it got the attention of some people at editorial. The existing process for creating and formatting a bibliography is so convoluted, it can take a week. We just started a project (today!) to train editorial and staff on Zotero and I'm basically the lead. Step 1 is getting this style right. This is the last issue we had that we can address (still waiting on the new CSL to fix the quote-comma order and to have proper localization support).
The peacocks are still obnoxious, but everyone forgot about them for a while. The quake here basically closed the "square" office floor pending a carefull analysis. There is even talk about closing it for good, but I think that would be drastic. Everyone is in temporary offices (cafeteria, parking lot, etc). I'm trying to lobby for a floating pool lounge chair in the laguna and a laptop.
Sala Prebisch is in fine shape, though.
Let me know if you ever come around here again...
It worked fine for me and its in the macro, so its quick and elegant.
Now to get my locale terms done.
PS: @adamsmith: if you look at the full code, you'll see 2 macros "onuventa" and "onusig" that are kludges. I had discussed the possibility of adding extra fields to zotero to handle the UN document case. Any news on this front?
Groups sometimes do weird things, in this case it messed with the conditional, I don't know exactly under which conditions that happens but the group markers seemed wrong there to start with so no harm in taking them out.
Sorry to hear about your office situation, hope things get back to normal soon. Although a floating chair in Santiago fall sun doesn't sound half bad.
<layout>
<group prefix="(" suffix=")">
<text value="Published by: "/>
<text variable="publisher"/>
</group>
</layout>
This results in "(Published by: Company A)" when the "publisher" variable is set to "Company A", but doesn't generate output when the "publisher" variable is empty.
In CSL 1.0, the rules will be changed a bit to reduce confusion: a group and its child elements are only suppressed if a) at least one rendering element in the group calls a variable (either directly or via a macro), and b) all variables that are called are empty. Thus, with CSL 1.0,
<group prefix="">
<choose>
<if variable="issued">
...
</if>
<else>
<text term="no date"/>
</else>
</choose>
</group>
will print "no date" if the "issued" variable is empty.