Difference between revisions of "Category:Tools/ZoteroToTEI"

From TEIWiki
Jump to navigation Jump to search
(xslt for transforming Zotero RDF to TEI <listBibl>)
(redirected to new page)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[[Category:Tools]]
+
#REDIRECT [[ZoteroToTEI]]
 
 
[[Category:Publishing and delivery tools]]
 
 
 
== Synopsis ==
 
 
 
This is an XSLT stylesheet to transform RDF/XML into TEI bibls
 
 
 
 
 
== User commentary ==
 
'''Please sign all comments.'''
 
(please leave the above note about signing comments, and add signed comments here below it)
 
 
 
== System requirements ==
 
 
 
 
 
== Source code and licensing ==
 
Source code is included at the bottom of this article
 
 
 
== Language(s) ==
 
[[XSLT]]
 
 
 
== 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.
 
<pre><nowiki>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<xsl:stylesheet 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"
 
version="2.0">
 
 
 
<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>
 
</nowiki></pre>
 

Latest revision as of 23:57, 27 February 2010

Redirect to:

This category currently contains no pages or media.