Help refining Harvard Style

Hi,

I've modified the OU Harvard Style which is *so* close to what I need for my college except for two minor details:-

1/ I need the author to be listed with first name initial only not the whole forename
2/ I need (n.d.) to show (No date)

I keep looking through the code (see bottom of this messsage) but cannot find where these two things are coded.

Any help very much appreciated.

Regards,
Terry.



<?xml version="1.0" encoding="UTF-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" xml:lang="en" class="in-text" >
<info>
<title>Open University Harvard Reference (dev)</title>
<id>http://www.zotero.org/styles/ou-harvard</id>;
<link href="http://www.zotero.org/styles/ou-harvard"/>
<author>
<name>Julian Onions</name>
<email>julian.onions@gmail.com</email>
</author>
<category term="author-date"/>
<category term="generic-base"/>
<updated>2008-03-25T15:47:07+00:00</updated>
<summary>The Open University Harvard author-date style</summary>
<link href="http://library.open.ac.uk/research/citastyle/index.cfm" rel="documentation"/>
</info>
<macro name="editor">
<names variable="editor" delimiter=", ">
<name and="text" initialize-with=". " delimiter=", " sort-separator=", " name-as-sort-order="all"/>
<label form="short" prefix=" (" text-case="lowercase" suffix=".)"/>
</names>
</macro>
<macro name="anon">
<text term="anonymous" form="short" text-case="capitalize-first"/>
</macro>
<macro name="author">
<names variable="author">
<name name-as-sort-order="all" and="text" sort-separator=", "
delimiter=", " delimiter-precedes-last="never" form="long"/>
<label form="short" prefix=" (" suffix=",)" text-case="lowercase"/>
<substitute>
<names variable="editor"/>
<text macro="anon"/>
</substitute>
</names>
</macro>
<macro name="author-short">
<names variable="author">
<name form="short" and="symbol" delimiter=", " delimiter-precedes-last="never" initialize-with=". "/>
<substitute>
<names variable="editor"/>
<names variable="translator"/>
<text macro="anon"/>
</substitute>
</names>
</macro>
<macro name="access">
<choose>
<if variable="URL">
<text term="online" text-case="capitalize-first" prefix="[" suffix="]"/>
<text value=" Available from: " />
<text variable="URL"/>
<group prefix=" [" delimiter=" " suffix="]">
<text term="accessed" text-case="capitalize-first"/>
<date variable="accessed" >
<date-part name="day" suffix=" "/>
<date-part name="month" suffix=" "/>
<date-part name="year"/>
</date>
</group>
</if>
</choose>
</macro>
<macro name="title">
<choose>
<if type="book">
<text variable="title" font-style="italic"/>
</if>
<else>
<text variable="title" font-style="italic" prefix="" suffix="."/>
</else>
</choose>
</macro>
<macro name="publisher">
<group delimiter=", ">
<text variable="publisher-place"/>
<text variable="publisher"/>
</group>
</macro>
<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>
<macro name="locator">
<choose>
<if type="article-journal">
<text variable="volume" />
<text variable="issue" prefix="(" suffix=")"/>
</if>
</choose>
</macro>
<macro name="published-date">
<choose>
<if type="article-newspaper">
<date variable="issued">
<date-part name="day" form="ordinal" suffix=" "/>
<date-part name="month" form="long"/>
</date>
</if>
</choose>
</macro>
<macro name="pages">
<choose>
<if type="chapter article-journal" match="any">
<label variable="page" form="short" suffix=". "/>
<text variable="page"/>
</if>
</choose>
</macro>
<macro name="edition">
<choose>
<if is-numeric="edition">
<group delimiter=" ">
<number variable="edition" form="ordinal"/>
<text term="edition" form="short" suffix="."/>
</group>
</if>
<else>
<text variable="edition" suffix="."/>
</else>
</choose>
</macro>
<macro name="container-prefix">
<choose>
<if type="chapter">
<text term="in" text-case="capitalize-first"/>
</if>
</choose>
</macro>
<citation>
<option name="et-al-min" value="4"/>
<option name="et-al-use-first" value="1"/>
<option name="et-al-subsequent-min" value="6"/>
<option name="et-al-subsequent-use-first" value="1"/>
<option name="disambiguate-add-year-suffix" value="true"/>
<option name="disambiguate-add-names" value="true"/>
<option name="disambiguate-add-givenname" value="true"/>
<option name="collapse" value="year"/>
<layout prefix="(" suffix=")" delimiter="; ">
<group delimiter=", ">
<group delimiter=", ">
<text macro="author-short"/>
<text macro="year-date"/>
</group>
<group>
<text term="page" form="short" suffix=". "/>
<text variable="locator"/>
</group>
</group>
</layout>
</citation>
<bibliography>
<option name="hanging-indent" value="true"/>
<option name="et-al-min" value="6"/>
<option name="et-al-use-first" value="4"/>
<sort>
<key macro="author"/>
<key variable="title"/>
</sort>
<layout suffix=".">
<group delimiter=" ">
<text macro="author" />
<text macro="year-date" prefix="(" suffix=")"/>
<text macro="title" suffix=""/>
<text macro="edition"/>
<text macro="container-prefix"/>
<group delimiter=", ">
<text macro="editor" />
<text variable="container-title" font-style="italic" />
<text variable="collection-title" />
<text variable="genre"/>
<text macro="publisher" />
<text macro="locator" />
<text macro="published-date"/>
<text macro="pages"/>
<text macro="access" />
</group>
</group>
</layout>
</bibliography>
</style>
  • 1) You need the "initialize-with" attribute on the "name" element. See http://www.zotero.org/support/dev/csl_syntax_summary#authors for more info.

    2) For the "n.d." a localized term is used. You can override these terms in your own style, see http://forums.zotero.org/discussion/8353/styles-bibliographies-years-in-wrong-order/?Focus=38783#Comment_38783 for an example. In your case, the lines to add would be:

    <terms>
    <locale xml:lang="en">
    <term name="no date">No date</term>
    </locale>
    </terms>
  • Thank you very much. I've managed to get work my way through those two changes. I think I need to check the other formats before I consider sharing.

    Is it possible for me to install the style I've created without publishing? I've tried installing via "preferences" and "+" and it asks me to confirm import but then does not show up in the list of styles.

    Regards,
    Terry.
  • that should work. You can also just drag a .csl file to an open Firefox window - Zotero will then ask you to confirm the install and you can use the style immediately.
  • Dragging and dropping seems to highlight and error somewhere - displays the following:-

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    --------------------------------------------------------------
    <style xml:lang="en" class="in-text">

    <info>
    <title>CCN Harvard Author-Date</title>

    <author>
    <name>Terry Newman</name>
    <email>terryjnewman@googlemail.com</email>
    </author>
    <category term="author-date"/>
    <category term="generic-base"/>
    <updated>2010-01-05T17:45:07+00:00</updated>
    <summary>CCN Harvard Author-Date Style</summary>
    </info>

    <terms>

    <locale xml:lang="en">
    <term name="no date">No date</term>
    </locale>
    </terms>

    <macro name="editor">

    <names variable="editor" delimiter=", ">
    <name and="text" initialize-with=". " delimiter=", " sort-separator=", " name-as-sort-order="all"/>
    <label form="short" prefix=" (" text-case="lowercase" suffix=".)"/>
    </names>
    </macro>

    <macro name="anon">
    <text term="anonymous" form="short" text-case="capitalize-first"/>
    </macro>

    <macro name="author">

    <names variable="author">
    <name name-as-sort-order="all" and="symbol" sort-separator=", " initialize-with=". " delimiter=", " delimiter-precedes-last="always"/>
    <label form="short" prefix=" (" suffix=".)" text-transform="capitalize"/>

    <substitute>
    <names variable="editor"/>
    <names variable="translator"/>
    <text macro="title"/>
    </substitute>
    </names>
    </macro>

    <macro name="author-short">

    <names variable="author">
    <name form="short" and="symbol" delimiter=", " delimiter-precedes-last="never" initialize-with=". "/>

    <substitute>
    <names variable="editor"/>
    <names variable="translator"/>
    <text macro="anon"/>
    </substitute>
    </names>
    </macro>

    <macro name="access">

    <choose>

    <if variable="URL">
    <text term="online" text-case="capitalize-first" prefix="[" suffix="]"/>
    <text value=" Available from: "/>
    <text variable="URL"/>

    <group prefix=" [" delimiter=" " suffix="]">
    <text term="accessed" text-case="capitalize-first"/>

    <date variable="accessed">
    <date-part name="day" suffix=" "/>
    <date-part name="month" suffix=" "/>
    <date-part name="year"/>
    </date>
    </group>
    </if>
    </choose>
    </macro>

    <macro name="title">

    <choose>

    <if type="book">
    <text variable="title" font-style="italic"/>
    </if>

    <else>
    <text variable="title" font-style="italic" prefix="" suffix=". "/>
    </else>
    </choose>
    </macro>

    <macro name="publisher">

    <group delimiter=": ">
    <text variable="publisher-place"/>
    <text variable="publisher"/>
    </group>
    </macro>

    <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>

    <macro name="locator">

    <choose>

    <if type="article-journal">
    <text variable="volume"/>
    <text variable="issue" prefix="(" suffix=")"/>
    </if>
    </choose>
    </macro>

    <macro name="published-date">

    <choose>

    <if type="article-newspaper">

    <date variable="issued">
    <date-part name="day" form="ordinal" suffix=" "/>
    <date-part name="month" form="long"/>
    </date>
    </if>
    </choose>
    </macro>

    <macro name="pages">

    <choose>

    <if type="chapter article-journal" match="any">
    <label variable="page" form="short" suffix=". "/>
    <text variable="page"/>
    </if>
    </choose>
    </macro>

    <macro name="edition">

    <choose>

    <if is-numeric="edition">

    <group delimiter=" ">
    <number variable="edition" form="ordinal"/>
    <text term="edition" form="long" suffix="."/>
    </group>
    </if>

    <else>
    <text variable="edition" suffix="."/>
    </else>
    </choose>
    </macro>

    <macro name="container-prefix">

    <choose>

    <if type="chapter">
    <text term="in" text-case="capitalize-first"/>
    </if>
    </choose>
    </macro>

    <citation>
    <option name="et-al-min" value="4"/>
    <option name="et-al-use-first" value="1"/>
    <option name="et-al-subsequent-min" value="6"/>
    <option name="et-al-subsequent-use-first" value="1"/>
    <option name="disambiguate-add-year-suffix" value="true"/>
    <option name="disambiguate-add-names" value="true"/>
    <option name="disambiguate-add-givenname" value="true"/>
    <option name="collapse" value="year"/>

    <layout prefix="(" suffix=")" delimiter="; ">

    <group delimiter=", ">

    <group delimiter=", ">
    <text macro="author-short"/>
    <text macro="year-date"/>
    </group>

    <group>
    <text term="page" form="short" suffix=". "/>
    <text variable="locator"/>
    </group>
    </group>
    </layout>
    </citation>

    <bibliography>
    <option name="hanging-indent" value="true"/>
    <option name="et-al-min" value="6"/>
    <option name="et-al-use-first" value="4"/>

    <sort>
    <key macro="author"/>
    <key variable="title"/>
    </sort>

    <layout suffix=".">

    <group delimiter=" ">
    <text macro="author"/>
    <text macro="year-date" prefix="(" suffix=")"/>
    <text macro="title" suffix=". "/>
    <text macro="edition"/>
    <text macro="container-prefix"/>

    <group delimiter=", ">
    <text macro="editor"/>
    <text variable="container-title" font-style="italic"/>
    <text variable="collection-title"/>
    <text variable="genre"/>
    <text macro="publisher"/>
    <text macro="locator"/>
    <text macro="published-date"/>
    <text macro="pages"/>
    <text macro="access"/>
    </group>
    </group>
    </layout>
    </bibliography>
    </style>
  • the gray bar with that meassage always gets displayed, disregard it.
    Do you get the "install" option popup? After you click OK you should have the style installed. Did you validate it?

    Uhm - but it looks like your style doesn't have an ID line - that's probably the problem.
    You need
    <id>http://www.zotero.org/styles/harvard-ccn</id>;
    <link href="http://www.zotero.org/styles/harvard-ccn"/>

    in the <info> section of the style. That's probably why it doesn't show up.
  • No, no install and/or popup.

    Copied and pasted lines you suggest (see extract below) but still doesn't like it:-


    <style xml:lang="en" class="in-text">

    <info>
    <title>CCN Harvard Author-Date</title>
    <id>http://www.zotero.org/styles/harvard-ccn</id>;
    <link href="http://www.zotero.org/styles/harvard-ccn"/>

    <author>
    <name>Terry Newman</name>
    <email>terryjnewman@googlemail.com</email>
    </author>
    <category term="author-date"/>
    <category term="generic-base"/>
    <updated>2010-01-05T17:45:07+00:00</updated>
    <summary>CCN Harvard Author-Date Style</summary>
    </info>

    <terms>

    <locale xml:lang="en">
    <term name="no date">No date</term>
    </locale>
    </terms>

    <macro name="editor">

    <names variable="editor" delimiter=", ">
    <name and="text" initialize-with=". " delimiter=", " sort-separator=", " name-as-sort-order="all"/>
    <label form="short" prefix=" (" text-case="lowercase" suffix=".)"/>
    </names>
  • can you upload your style somewhere? (any free upload site will do).
    Are you sure it's saved as a .csl rather than .csl.txt?
    Did you validate it?
  • .csl definitely.

    No, I didn't validate it. How do I do it, sorry, probably an RTFM situation?
  • http://www.zotero.org/support/dev/creating_citation_styles#xml_validation

    but not super obvious find, so I'll leave out the "F" of RTFM ;-)
  • OK, I've run the code through http://validator.nu/ and it reports:-

    <highlighted in blue bar>
    1.Info: The Content-Type was application/octet-stream. Using the XML parser (not resolving external entities).

    <highlighted in red bar>
    2.Schema Error: Cannot find preset schema for namespace: .

    The result cannot be determined due to a non-document-error.
    Total execution time 1 milliseconds

    Does that mean anything to you Adam?
  • I think it'd be quicker if you posted the actual file somewhere and linked to it, as adamsmith suggested above. Then we could tell you if there's a problem with the file or a problem on your system.
  • However from that error message it looks like you're missing the CSL namespace, e.g.:

    <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" xml:lang="en">
  • Note that, when copying XML from Firefox, you need to use View Source, since the pretty-printed (gray-bar-at-top) version doesn't include all information (such as namespaces).
  • yeah - copy it from your text editor, not from firefox, there might be other problems.
    Also, it looks like you haven't included the URL of the schema:
    http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/csl/schema/tags/0.8/csl.rnc
  • I added the new <style> section which still threw up a message from the validator however, it does import and work in Zotero.

    Where does the http line need to go? I've looked at a couple of other styles and can't see it?

    Validator output:-

    <blue bar>
    1.Info: The Content-Type was application/octet-stream. Using the XML parser (not resolving external entities).

    <red bar>
    2. Schema Error: Cannot find preset schema for namespace: http://purl.org/net/xbiblio/csl.

    File shared:-
    http://www.filefactory.com/file/a1760a3/n/CCN_Harvard_Author_Date.csl
  • Where does the http line need to go? I've looked at a couple of other styles and can't see it?
    It's just a processing instruction for people using oXygen for validation—it's not required. But see http://www.zotero.org/styles/apa (again, View Source) for an example.

    Anyway, that's the expected output from that validator for a valid CSL file.
  • edited January 7, 2010
    the http line is for the validator, not for the style. That's what's not working in the validation.

    Dan - expected output for a valid style using validator looks like this:

    1.

    Warning: Being lax about non-RNC Content-Type: text/plain

    http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/csl/schema/tags/0.8/csl.rnc
    2.

    Warning: text/* type without a charset parameter seen. Would have defaulted to US-ASCII had the lax option not been chosen.

    http://www.zotero.org/styles/ama
    3.

    Info: The Content-Type was text/xml. Using the XML parser (not resolving external entities).

    The document validates according to the specified schema(s).
  • Thanks Dan.

    Thanks for all who helped - very much appreciated. It's very satisying when the biblio output comes out just as you want it.

    Cheers,
    Terry.
  • in case someone wants this - the upload link doesn't work
  • the http line is for the validator, not for the style. That's what's not working in the validation.

    Dan - expected output for a valid style using validator looks like this:
    Ah, I see what you were referring to. Yes, that's right.

    But while people should certainly validate their styles, even invalid styles should install into Zotero as long as they're valid, properly namespaced XML, which is why I was focusing on that in this case.
  • (Of course, whether or not they should is debatable, but until Mozilla supports RELAX NG validation or we bundle a JS-based validator, they will.)

This is an old discussion that has not been active in a long time. Instead of commenting here, you should start a new discussion. If you think the content of this discussion is still relevant, you can link to it from your new discussion.