Questions arising when programming a new style

Hi there,

I am trying to set up a new style, but I have a number of problems:

- Filler words and expressions ("et al.", "editor" and the like need to be in Danish). That does not seem to work.

- Instead of a "vol. " in front of the volume number, I need a ". årgang" as a suffix. But that does only make sense when the volume is number (and not a "Jubilee Issue"), is there a way to program this?

- I get a comma in front of & (for example: "Reinemann, Carsten, & Jürgen Wilke (2003)") - how can I get rid of it?

dnh
  • Here the code:

    <?xml version="1.0" encoding="UTF-8"?>
    <style xmlns="http://purl.org/net/xbiblio/csl" xml:lang="dk" class="in-text" >
    <info>
    <title>Journalistica</title>
    <id>Journalistica</id>
    <author>
    <name>David Nicolas Hopmann</name>
    <email>dnh@gmx.net</email>
    </author>
    <category term="author-date"/>
    <category term="journalism studies"/>
    <updated>2009-07-06</updated>
    <summary>The Journalistica style.</summary>
    </info>

    <terms>
    <term name="editor" form="short"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="editor"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="et-al">mfl.</term>
    <term name="and">og</term>
    <term name="page" form="short"> <single>s.</single> <multiple>s.</multiple> </term>
    <term name="page"> <single>s.</single> <multiple>s.</multiple> </term>
    </terms>

    <macro name="editor">
    <names variable="editor">
    <name and="symbol" delimiter=", "/>
    <label text-case="lowercase" prefix=" (" suffix=")"/>
    </names>
    </macro>
    <macro name="series-editor">
    <names variable="original-author">
    <label form="short" text-case="capitalize-first" suffix=". "/>
    <name and="text" delimiter=", "/>
    </names>
    </macro>
    <macro name="anon">
    <text term="anonymous" form="short" text-case="capitalize-first"/>
    </macro>

    <macro name="author">
    <names variable="author">
    <name and="symbol" name-as-sort-order="first" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
    <label form="short" prefix=", " suffix="." text-case="lowercase"/>
    <substitute>
    <names variable="editor"/>
    <names variable="translator"/>
    <text macro="anon"/>
    </substitute>
    </names>
    </macro>
    <macro name="author-short">
    <names variable="author">
    <name form="short" and="symbol" delimiter=", "/>
    <substitute>
    <names variable="editor"/>
    <names variable="translator"/>
    <text macro="anon"/>
    </substitute>
    </names>
    </macro>
    <macro name="access">
    <group>
    <text variable="URL"/>
    <group prefix=" (" suffix=")">
    <text term="accessed" text-case="capitalize-first" suffix=" "/>
    <date variable="accessed">
    <date-part name="month" suffix=" "/>
    <date-part name="day" suffix=", "/>
    <date-part name="year"/>
    </date>
    </group>
    </group>
    </macro>
    <macro name="title">
    <choose>
    <if type="thesis">
    <text variable="title"/>
    </if>
    <else-if type="book">
    <text variable="title"/>
    </else-if>
    <else>
    <text variable="title" quotes="true"/>
    </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="u.å." form="short"/>
    </else>
    </choose>
    </macro>
    <macro name="day-month">
    <date variable="issued">
    <date-part name="month"/>
    <date-part name="day" prefix=" "/>
    </date>
    </macro>
    <macro name="pages">
    <label variable="page" form="short" suffix=". " text-case="lowercase"/>
    <text variable="page"/>
    </macro>
    <macro name="edition">
    <choose>
    <if is-numeric="edition">
    <group delimiter=" ">
    <number variable="edition"/>
    <text term="edition" form="short"/>
    </group>
    </if>
    <else>
    <text variable="edition"/>
    </else>
    </choose>
    </macro>

    <citation>
    <option name="et-al-min" value="3"/>
    <option name="et-al-use-first" value="1"/>
    <option name="et-al-subsequent-min" value="3"/>
    <option name="et-al-subsequent-use-first" value="1"/>
    <option name="disambiguate-add-year-suffix" value="true"/>
    <option name="disambiguate-add-names" value="false"/>
    <option name="collapse" value="year"/>
    <layout prefix="(" suffix=")" delimiter="; ">
    <group delimiter=": ">
    <group delimiter=" ">
    <text macro="author-short" suffix=","/>
    <text macro="year-date"/>
    </group>
    <text variable="locator"/>
    </group>
    </layout>
    </citation>

    <bibliography>
    <option name="hanging-indent" value="true"/>
    <option name="et-al-min" value="6"/>
    <option name="et-al-use-first" value="1"/>
    <sort>
    <key macro="author"/>
    <key variable="issued"/>
    </sort>
    <layout suffix=".">
    <group delimiter=" ">
    <text macro="author" suffix=""/>
    </group>
    <choose>
    <if type="article-newspaper article-magazine" match="any">
    <group delimiter=" ">
    <text macro="year-date" prefix=" (" suffix=")."/>
    <text macro="title" prefix="" suffix=","/>
    </group>
    <group prefix=" " delimiter=", ">
    <text variable="container-title" font-style="italic"/>
    <text macro="day-month"/>
    <text variable="edition"/>
    <text macro="pages" suffix="."/>
    </group>
    </if>

    <else-if type="article-journal">
    <group delimiter=" ">
    <text macro="year-date" prefix=" (" suffix=")."/>
    <text macro="title" prefix="" suffix=","/>
    </group>
    <group class="container" prefix=" " delimiter=" ">
    <text variable="container-title" suffix="," font-style="italic"/>
    <group delimiter=", ">
    <text variable="volume" suffix=". årgang"/>
    <text variable="edition" prefix="nr. "/>
    <text macro="pages" suffix="."/>
    </group>
    </group>
    </else-if>

    <else-if type="thesis">
    <text macro="year-date" prefix=" (" suffix=")."/>
    <text macro="title" prefix=" " suffix=","/>
    <group prefix=" " delimiter=", ">
    <text macro="edition" />
    <text macro="editor" suffix="."/>
    <text variable="genre"/>
    <text macro="publisher"/>
    </group>
    </else-if>

    <else-if type="book">
    <group delimiter=" ">
    <text macro="year-date" prefix=" (" suffix=")."/>
    <text macro="title" prefix="" suffix="," font-style="italic"/>
    <text macro="edition" />
    <text macro="editor" suffix="."/>
    <text macro="publisher"/>
    </group>
    </else-if>

    <else-if type="chapter">
    <group delimiter=" ">
    <text macro="year-date" prefix=" (" suffix=")."/>
    <text macro="title" prefix="" suffix=","/>
    <group class="container" delimiter=", " suffix=",">
    <group delimiter=" ">
    <text macro="pages"/>
    <text macro="editor" prefix="i " suffix=","/>
    <text variable="container-title" font-style="italic"/>
    </group>
    <text variable="volume" suffix=". årgang"/>
    <text variable="collection-title"/>
    </group>
    <text macro="publisher"/>
    </group>
    </else-if>

    <else>
    <group suffix=" " >
    <text macro="year-date" prefix=" (" suffix=")."/>
    <text macro="title" prefix=" '" suffix="',"/>
    <text macro="editor" prefix=" "/>
    </group>
    <group class="container" prefix=" " delimiter=" ">
    <text variable="container-title" suffix="," font-style="italic"/>
    <group delimiter=": ">
    <text variable="volume" />
    <text variable="page" suffix="."/>
    </group>
    </group>
    </else>
    </choose>
    <text prefix=" " macro="access" suffix="."/>
    </layout>
    </bibliography>
    </style>
  • edited July 6, 2009
    - Filler words and expressions ("et al.", "editor" and the like need to be in Danish). That does not seem to work.
    http://forums.zotero.org/discussion/4004/?Focus=17166#Comment_17166
    - Instead of a "vol. " in front of the volume number, I need a ". årgang" as a suffix. But that does only make sense when the volume is number (and not a "Jubilee Issue"), is there a way to program this?
    Yes, check if the value of the volume is numeric. E.g.
    <choose>
    <if is-numeric="volume">
    <number variable="volume" suffix=". argang"/>
    </if>
    <else>
    <text variable="volume"/>
    </else>
    </choose>
    (you might need to escape the å character)
    - I get a comma in front of & (for example: "Reinemann, Carsten, & Jürgen Wilke (2003)") - how can I get rid of it?
    Set delimiter-precedes-last in the author macro to "never" .
  • Rintze, again thanks for your help

    ad 1: But what can I then use the terms-command for? I want to force everyone to use the Danish ones (even if they, say, write in Swedish). And: My locale is empty, it always goes for the English ones. And I've noticed that http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/csl/locales/locales-da-DK.xml?view=markup is actually not translated...

    ad 2: Works!

    ad 3: Works!

    Thanks a lot - once I'm finished, I'll send you a copy so you can upload it! ;-)
  • edited July 6, 2009
    But what can I then use the terms-command for?
    Redefining existing terms.
    I want to force everyone to use the Danish ones (even if they, say, write in Swedish).
    Bork. There is a nice fix for this (default-locale), but it's not yet supported by Zotero :). See http://www.zotero.org/support/dev/csl_syntax_summary#preamble to see what you're missing. Because this feature is still unsupported, you might go for the terms-redefining for the near-term. That wouldn't work for user's who have set their bibliography-locale to anything other than English though, unless you redefine the terms for each and every locale.
    And: My locale is empty
    What exactly do you mean by this?
    Correct. If you feel up to it, you can contribute to the Danish translation of Zotero via http://www.babelzilla.org/.
  • ad 1: But is this not what I did in my code? It does not seem to work... ?

    ad 3: When I look op the hidden pref for locale in about:config, it is set to nothing, the cell is empty. The language of my Firefox is German.

    ad 4: Ups.. yet another page I don't find intuitive... where do I find the xml-locale? I guess I will just translate it in a spare moment and mail it to you... ;-)
  • I've decided to carpet bomb, it works this way:

    <terms>
    <locale xml:lang="dk">
    <term name="editor" form="short"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="editor"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="et-al">mfl.</term>
    <term name="and">og</term>
    <term name="page" form="short"> <single>s.</single> <multiple>s.</multiple> </term>
    <term name="page"> <single>s.</single> <multiple>s.</multiple> </term>
    </locale>
    </terms>

    <terms>
    <locale xml:lang="en">
    <term name="editor" form="short"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="editor"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="et-al">mfl.</term>
    <term name="and">og</term>
    <term name="page" form="short"> <single>s.</single> <multiple>s.</multiple> </term>
    <term name="page"> <single>s.</single> <multiple>s.</multiple> </term>
    </locale>
    </terms>

    <terms>
    <locale xml:lang="de">
    <term name="editor" form="short"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="editor"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="et-al">mfl.</term>
    <term name="and">og</term>
    <term name="page" form="short"> <single>s.</single> <multiple>s.</multiple> </term>
    <term name="page"> <single>s.</single> <multiple>s.</multiple> </term>
    </locale>
    </terms>

    <terms>
    <locale xml:lang="se">
    <term name="editor" form="short"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="editor"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="et-al">mfl.</term>
    <term name="and">og</term>
    <term name="page" form="short"> <single>s.</single> <multiple>s.</multiple> </term>
    <term name="page"> <single>s.</single> <multiple>s.</multiple> </term>
    </locale>
    </terms>

    <terms>
    <locale xml:lang="no">
    <term name="editor" form="short"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="editor"> <single>red.</single> <multiple>red.</multiple> </term>
    <term name="et-al">mfl.</term>
    <term name="and">og</term>
    <term name="page" form="short"> <single>s.</single> <multiple>s.</multiple> </term>
    <term name="page"> <single>s.</single> <multiple>s.</multiple> </term>
    </locale>
    </terms>
  • edited July 6, 2009
    Rintze,

    That's interesting. So in the new processor, locales are mis-implemented, since they are set using the xml:lang attribute ... ?. It should instead be using the default-locale attribute ... ?

    Odd that no one called me to account over this before. Easy to fix though.

    From reading the doc linked above, it's not quite clear to me whether xml:lang needs to be implemented at all. If everything is in UTF-8, string values will just work, right? Or am I missing something? Or maybe I'm misunderstanding what "argument values" means in XML?

    I'll note in passing that I'm not the only one to misunderstand this option. There are six German, one French and two Spanish styles in the repository that presumably use xml:lang in the same way. So maybe I'm not misunderstanding after all?

    (Edited to add question about xml:lang implementation, and note on existing use of the attribute.)
  • ad 1: But is this not what I did in my code? It does not seem to work... ?
    dnh and I fixed this via email. Solution: don't put multiple terms element in a style (and validate your style). The different locale elements can just be put into a single terms element.
    ad 3: When I look op the hidden pref for locale in about:config, it is set to nothing, the cell is empty. The language of my Firefox is German.
    It's empty because the default locale for terms used in styles is the locale of Firefox. Only if you want to override that locale the extensions.zotero.export.bibliographyLocale-pref field should be filled.
    ad 4: Ups.. yet another page I don't find intuitive... where do I find the xml-locale? I guess I will just translate it in a spare moment and mail it to you... ;-)
    Which page do you find unintuitive? If you give a pointer I can try to improve the page.
Sign In or Register to comment.