Reference type mapping between Zotero and CSL

Hi Guys,

I have found some information about field mapping between Zotero and CSL (CSL Variables), but nothing on reference type (e.g. article, book, chapter, map).

I am trying to prepare some styles for some scientific journals and the BOOK, CHAPTER and ARTICLE (as fall back) structure is limited. I need to update the macros and formatting sections in the CSL file to reflect a range of other reference types.

Any help would be appreciated.
  • So how is this code listed below interpreted?

    If I am reading it right the format is Zotero:CSL -- so a 'letter' in Zotero Database would be captured by the command <if type="personal_communication"> in the CSL file. Is this correct?

    Also, I realise the default option is how the item is captured by the CSL file if the reference type is not referenced in the CSL file. Is this correct?

    Why don't CSL files provide every conceivable option? Is their a performance issue when specifying specific options for every reference type available in Zotero? I rummaged through the CSL Style Repository and most files really only defined BOOK, CHAPTER and a fallback which was formatted like a ARTICLE.

    What is the best structure for capturing more than 2 main reference types?


    <choose>
    <if type="book">
    <text variable="title"/>
    </if>
    <else-if type="chapter">
    <text variable="title"/>
    </else-if>
    <else-if type="conferencePaper">
    <text variable="title"/>
    </else-if>
    <else-if type="report">
    <text variable="title"/>
    </else-if>
    <else-if>
    <text variable="title"/>
    </else-if>
    <else>
    <text variable="title" quotes="true"/>
    </else>
    </choose>


    ADDENDUM: REFERENCE-TYPE MAPPING EXTRACTED FROM ABOVE LINK -- Zotero:CSL


    2164 Zotero.CSL.Item._optionalTypeMap = {
    2165 journalArticle:"article-journal",
    2166 magazineArticle:"article-magazine",
    2167 newspaperArticle:"article-newspaper",
    2168 thesis:"thesis",
    2169 conferencePaper:"paper-conference",
    2170 letter:"personal_communication",
    2171 manuscript:"manuscript",
    2172 interview:"interview",
    2173 film:"motion_picture",
    2174 artwork:"graphic",
    2175 webpage:"webpage",
    2176 report:"report",
    2177 bill:"bill",
    2178 case:"legal_case",
    2179 hearing:"bill", // ??
    2180 patent:"patent",
    2181 statute:"bill", // ??
    2182 email:"personal_communication",
    2183 map:"map",
    2184 blogPost:"webpage",
    2185 instantMessage:"personal_communication",
    2186 forumPost:"webpage",
    2187 audioRecording:"song", // ??
    2188 presentation:"speech",
    2189 videoRecording:"motion_picture",
    2190 tvBroadcast:"broadcast",
    2191 radioBroadcast:"broadcast",
    2192 podcast:"song", // ??
    2193 computerProgram:"book" // ??
    2194 };
    2195
    2196 // TODO: check with Elena/APA/MLA on this
    2197 Zotero.CSL.Item._fallbackTypeMap = {
    2198 book:"book",
    2199 bookSection:"chapter",
    2200 journalArticle:"article",
    2201 magazineArticle:"article",
    2202 newspaperArticle:"article",
    2203 thesis:"article",
    2204 encyclopediaArticle:"chapter",
    2205 dictionaryEntry:"chapter",
    2206 conferencePaper:"chapter",
    2207 letter:"article",
    2208 manuscript:"article",
    2209 interview:"article",
    2210 film:"book",
    2211 artwork:"book",
    2212 webpage:"article",
    2213 report:"book",
    2214 bill:"book",
    2215 case:"book",
    2216 hearing:"book",
    2217 patent:"article",
    2218 statute:"book",
    2219 email:"article",
    2220 map:"article",
    2221 blogPost:"article",
    2222 instantMessage:"article",
    2223 forumPost:"article",
    2224 audioRecording:"book",
    2225 presentation:"article",
    2226 videoRecording:"book",
    2227 tvBroadcast:"article",
    2228 radioBroadcast:"article",
    2229 podcast:"article",
    2230 computerProgram:"book"
  • So how is this code listed below interpreted?
    You had a few code blocks, so please specify the one you are referring to.
    Also, I realise the default option is how the item is captured by the CSL file if the reference type is not referenced in the CSL file. Is this correct?
    What do you mean by "default option?" If you are outside of an <if /&gt> block, then the code likely applies to ALL types. Most citation styles are fairly independent of type & type-specific code is only intended to handle quirks. It is best to have as few types as needed & to use generic code where possible.
    Why don't CSL files provide every conceivable option?
    What is it missing? You can make a CSL file that checks for each type & formats each type independently, with no generic fall-back. But this is almost always a bad idea--it makes your file longer and harder to follow & much of the code would be redundant.
    I rummaged through the CSL Style Repository and most files really only defined BOOK, CHAPTER and a fallback which was formatted like a ARTICLE.
    Many styles for journals will only list these three. Other styles that list more types actually use identical syntax amongst many types.
    What is the best structure for capturing more than 2 main reference types?
    By writing generic code. The example codeblock you have seems to take the same action, regardless of type. So why not just ditch the choose block & specify only:
    <text variable="title"/>so that it will apply to all references, regardless of type.
  • POINT 1

    So how is this code listed below interpreted?

    Zotero.CSL.Item._optionalTypeMap = {

    versus

    Zotero.CSL.Item._fallbackTypeMap = {

    POINT 2

    Why is a CSL file that specifically handles a range of reference types redundant?

    POINT 3

    In my example where it appeared that the code
    <text variable="title"/>
    was the only outcome it was only because I had not offer any alternative formatting. The question was whether the language construct was correct? That is ...

    <choose>
    <if type="book">
    - specific formatted string
    </if>
    <else-if type="chapter">
    - specific formatted string
    </else-if>
    <else-if type="conferencePaper">
    - specific formatted string
    </else-if>
    <else-if type="report">
    - specific formatted string
    </else-if>
    <else-if>
    - specific formatted string
    </else-if>
    <else>
    - default formatting
    </else>
    </choose>


    If I use this type of construct (not all the time but only where needed) I capture the 5-10 standard reference types used in a lot of scientific journals but also have a default option. Am I interpreting this correctly.

    POINT 4

    Taking you point about difficult to maintain code. Can you insert commenting into CSL files? If so, how?
  • Why is a CSL file that specifically handles a range of reference types redundant?
    Because, put simply, it's seldom necessary. Therefore, by definition, you have a lot of unnecessary (read, redundant) code.

    Look at the APA style, or some of the Chicago ones, for pretty good models.
    If I use this type of construct (not all the time but only where needed) I capture the 5-10 standard reference types used in a lot of scientific journals but also have a default option. Am I interpreting this correctly.
    Yeah, but look at this differently. Forget about the types. How many different ways are there to format a title? Three (plain, quotes, italic)? If that's the case, then why do you have so many different conditions? You only need two plus the default.
    Taking you point about difficult to maintain code. Can you insert commenting into CSL files? If so, how?
    Use standard XML comments (try google).
Sign In or Register to comment.