Difference between revisions of "Citation Style Language"

From Code4Lib
Jump to: navigation, search
(References)
(Embedding CSL records in twitter annotations)
Line 39: Line 39:
 
* http://groups.google.com/group/twitter-meta
 
* http://groups.google.com/group/twitter-meta
  
The CSL input format is also JSON but you need to specify a root element and how to deal with multiple references.
+
The CSL input format is also JSON but you need to specify a root element and how to deal with multiple references. This is how an annotation could look like:
 +
 
 +
<pre> 
 +
{ "cslrecords" : {
 +
    "ITEM-2" : {
 +
"author": [ {
 +
"family": "Bennett",
 +
"given": "Frank G.",
 +
"suffix": "Jr.",
 +
"static-ordering": false
 +
} ],
 +
"title":"Getting Property Right: \"Informal\" Mortgages in the Japanese Courts",
 +
"container-title":"Pacific Rim Law & Policy Journal",
 +
"volume": "18",
 +
"page": "463-509",
 +
"issued": { "date-parts": [ [2009, 8] ] },
 +
"type": "article-journal"
 +
    }
 +
}
 +
</pre>
 +
 
 +
But you could also wrap the single records in a way to easily add more non-CSL data to it:
 +
 
 +
<pre>
 +
{ "bibrecords":
 +
    "ITEM-2" : {
 +
      "csl" : {
 +
"author": [ {
 +
"family": "Bennett",
 +
"given": "Frank G.",
 +
"suffix": "Jr.",
 +
"static-ordering": false
 +
} ],
 +
"title":"Getting Property Right: \"Informal\" Mortgages in the Japanese Courts",
 +
"container-title":"Pacific Rim Law & Policy Journal",
 +
"volume": "18",
 +
"page": "463-509",
 +
"issued": { "date-parts": [ [2009, 8] ] },
 +
"type": "article-journal"
 +
      },
 +
      "identifier" [
 +
        "urn:issn:1066-8632",
 +
        "http://ssrn.com/abstract=1541102",
 +
        "bibkey:18561d99b88967f176f0e4ab63d230c0e"
 +
      ]
 +
  }
 +
}
 +
</pre>
  
 
== References ==
 
== References ==

Revision as of 12:43, 28 April 2010

The Citation Style Language (CSL) is an XML-Based stylesheet language for formatting of citations and bibliographies. It is used in reference management software such as Zotero, Mendeley, CiteProc and Pandoc. CSL was initiated by Bruce D’Arcus in the XBib project. The CSL 1.0 specification was published in March 2010.

The idea behind CSL

If you know BibTeX you can compare CSL with the BibTeX style file language BAFLL (BibTeX Anonymous Forth-Like). If you know XSL than you can compare it with XSLT. The basic idea is to seperate bibliographic data and a citation styles that can be used to create nicely formatted citations.

                           CSL-Style
                               |
                               v
 Bibliographic record -> CSL-Processor -> Citation

CLS-Processors are available in different programming languages. The most elaborated CSL-Processor is citeproc-js.

Getting started

If you use a reference management software such as Zotero you already use CLS under the hood. If you want to dig your hands into code, have a look at citeproc-js:

 hg clone http://bitbucket.org/fbennett/citeproc-js

Documentation is located in the manual directory or online at http://gsl-nagoya-u.net/http/pub/citeproc-doc.html and a demo that runs in a Browser is available at http://gsl-nagoya-u.net/http/pub/citeproc-demo/demo.html

Bibliographic record format

Of course you cannot throw any bibliographic record format into a CSL-Processor but you must use the field names defined in the CSL 1.0 specification. Some of the fields are repeatable and have an interal structure as described here.

If you want to use some other format (BibTeX, RIS, MARC, MODS, Bibliographic Ontology etc.) you go this way:

 Record in your format -> some miracle occurs -> record in CSL format -> CSL-Processor -> Citation

Please replace "some miracle occurs" with the conversion service of your choice, for instance Zotero or some library software hacks that libraries tend to use. There is nothing wrong with specific bibliographic formats but its not their purpose to create citations (counterexamples: BibTeX and RIS).

Embedding CSL records in twitter annotations

On the Code4lib mailing list it has been discussed to embed bibliographic data in twitter annotations. If this annotations contain CSL records then you could display a bibliographic reference in the citation style of your choice.

A twitter annotation is a JSON object with up to 512 bytes (later more):

The CSL input format is also JSON but you need to specify a root element and how to deal with multiple references. This is how an annotation could look like:

  
{ "cslrecords" : {
    "ITEM-2" : {
	"author": [ {
			"family": "Bennett",
			"given": "Frank G.",
			"suffix": "Jr.",
			"static-ordering": false
	} ],
	"title":"Getting Property Right: \"Informal\" Mortgages in the Japanese Courts",
	"container-title":"Pacific Rim Law & Policy Journal",
	"volume": "18",
	"page": "463-509",
	"issued": { "date-parts": [ [2009, 8] ]	},
	"type": "article-journal"
     }
}

But you could also wrap the single records in a way to easily add more non-CSL data to it:

{ "bibrecords":
    "ITEM-2" : {
      "csl" : {
	"author": [ {
			"family": "Bennett",
			"given": "Frank G.",
			"suffix": "Jr.",
			"static-ordering": false
	} ],
	"title":"Getting Property Right: \"Informal\" Mortgages in the Japanese Courts",
	"container-title":"Pacific Rim Law & Policy Journal",
	"volume": "18",
	"page": "463-509",
	"issued": { "date-parts": [ [2009, 8] ]	},
	"type": "article-journal"
      },
      "identifier" [
         "urn:issn:1066-8632",
         "http://ssrn.com/abstract=1541102",
         "bibkey:18561d99b88967f176f0e4ab63d230c0e"
      ]
   }
}

References

Alternatives

  • http://www.refbase.net/ is open source and contains import filters and citation styles to create citations from bibliographic data

This page is licensed under CC-BA-SA and thus can be used on other pages such as Wikipedia as you like