ZoteroToTEI
Jump to navigation
Jump to search
Contents
Synopsis
This is an XSLT stylesheet to transform RDF/XML into TEI bibls.
There is a good summary of the status of TEI/zotero interoperability at http://www.zotero.org/support/kb/tei . The official TEI bibliography is being constructed at http://www.zotero.org/groups/tei .
User commentary
Please sign all comments.
- This version does not generate valid TEI fragments for book sections. A newer version is at https://github.com/paregorios/Zotero-RDF-to-TEI-XML . (Kshawkin)
- See also TEIZoteroTranslator, which is now integrated into the Zotero plugin. (Kshawkin)
System requirements
Source code and licensing
- Source code is included at the bottom of this article
- It was initially developed and posted by Laura Mandell (posted via Paul Caton) Announcement on TEI-L
Language(s)
Documentation
None
Tech support
None
Here follows a Zotero to TEI XSLT, a simple one, that takes Zotero exported RDF and turns it into a listBibl with biblStruct.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:vcard="http://nwalsh.com/rdf/vCard#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:z="http://www.zotero.org/namespaces/export#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:bib="http://purl.org/net/biblio#"
xmlns:link="http://purl.org/rss/1.0/modules/link/"
xmlns:prism="http://prismstandard.org/namespaces/1.2/basic/"
exclude-result-prefixes="xs rdf tei dc vcard foaf z dcterms bib link prism"
>
<xsl:output method="xml" escape-uri-attributes="yes" indent="yes"/>
<xsl:template match="/rdf:RDF">
<listBibl>
<head>Works Cited</head>
<xsl:apply-templates/>
</listBibl>
</xsl:template>
<xsl:template match="bib:Memo"/>
<xsl:template match="z:Attachment"/>
<xsl:template match="bib:Book">
<biblStruct>
<monogr>
<title>
<xsl:value-of select="dc:title"/>
</title>
<xsl:call-template name="author"/>
<imprint>
<publisher>
<xsl:value-of select="dc:publisher/foaf:Organization/foaf:name"/>
</publisher>
<date>
<xsl:choose>
<xsl:when test="contains(dc:date, '-')">
<xsl:value-of select="substring-before(dc:date, '-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="dc:date"/>
</xsl:otherwise>
</xsl:choose>
</date>
</imprint>
</monogr>
</biblStruct>
</xsl:template>
<xsl:template match="rdf:li">
<author>
<persName>
<forename>
<xsl:value-of select="foaf:Person/foaf:givenname"/>
</forename>
<surname>
<xsl:value-of select="foaf:Person/foaf:surname"/>
</surname>
</persName>
</author>
</xsl:template>
<xsl:template match="bib:Article">
<biblStruct>
<analytic>
<title><xsl:value-of select="dc:title"/></title>
<xsl:call-template name="author"/>
</analytic>
<monogr>
<title>
<xsl:value-of select="following-sibling::bib:Journal[1]/dc:title"/>
</title>
<imprint>
<date><xsl:value-of select="dc:date"/></date>
<biblScope type="vol"><xsl:value-of select="following-sibling::bib:Journal[1]/prism:volume"/></biblScope>
<biblScope type="issue"><xsl:value-of select="following-sibling::bib:Journal[1]/prism:number"/></biblScope>
<biblScope type="pp"><xsl:value-of select="bib:pages"/></biblScope>
</imprint>
</monogr>
</biblStruct>
</xsl:template>
<xsl:template match="bib:Journal"/>
<xsl:template match="bib:Document"/>
<xsl:template match="rdf:Description">
<xsl:choose>
<xsl:when test="z:itemType = 'conferencePaper'">
<biblStruct>
<analytic>
<title>
<xsl:value-of select="dc:title"/>
</title>
<xsl:call-template name="author"/>
</analytic>
</biblStruct>
</xsl:when>
<!-- add outputs for other kinds of objects you collect -->
</xsl:choose>
</xsl:template>
<xsl:template match="z:Collection"/>
<xsl:template name="author">
<xsl:apply-templates select="bib:authors/rdf:Seq/rdf:li"/>
</xsl:template>
</xsl:stylesheet>