<?xml version='1.0'?>
<xsl:stylesheet
version='1.0'
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:purl='http://purl.org/rss/1.0/'
xmlns:slash='http://purl.org/rss/1.0/modules/slash/'
xmlns:content='http://purl.org/rss/1.0/modules/content/'
xmlns:connotea='http://www.connotea.org/2005/01/schema#'
xmlns:dcterms='http://purl.org/dc/terms/'
xmlns:prism='http://prismstandard.org/namespaces/1.2/basic/'
xmlns:annotate='http://purl.org/rss/1.0/modules/annotate/'
xmlns:syn='http://purl.org/rss/1.0/modules/syndication/'
xmlns:dc='http://purl.org/dc/elements/1.1/'
xmlns:taxo='http://purl.org/rss/1.0/modules/taxonomy/'
xmlns:admin='http://webns.net/mvcb/'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='text' />
<xsl:template match='/'>
<xsl:apply-templates select='rdf:RDF'/>
</xsl:template>
<xsl:template match='rdf:RDF'>
<xsl:apply-templates select='purl:item'/>
</xsl:template>
<xsl:template match='purl:item'>
@ARTICLE{<xsl:value-of select='generate-id(.)'/>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>TITLE</xsl:with-param>
<xsl:with-param name='value'><xsl:value-of select='purl:title'/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>URL</xsl:with-param>
<xsl:with-param name='value'><xsl:value-of select='connotea:uri/dcterms:URI/@rdf:about'/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>author</xsl:with-param>
<xsl:with-param name='value'><xsl:for-each select='dcterms:URI/dc:creator'><xsl:value-of select='translate(.,',',' ')'/>,</xsl:for-each></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>journal</xsl:with-param>
<xsl:with-param name='value'><xsl:for-each select='dcterms:URI/prism:publicationName'><xsl:value-of select='translate(.,',',' ')'/>,</xsl:for-each></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>keywords</xsl:with-param>
<xsl:with-param name='value'><xsl:for-each select='dc:subject'><xsl:value-of select='translate(.,',',' ')'/><xsl:text> </xsl:text> </xsl:for-each></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>comment</xsl:with-param>
<xsl:with-param name='value'><xsl:value-of select='purl:description'/></xsl:with-param>
</xsl:call-template>
}
</xsl:template>
<xsl:template name='make-fied'>
<xsl:param name='key'/>
<xsl:param name='value'/>
<xsl:if test='string-length(normalize-space($value))>0'>
<xsl:text>,
</xsl:text>
<xsl:value-of select='$key'/>="<xsl:call-template name='tex'>
<xsl:with-param name='s'><xsl:value-of select='$value'/></xsl:with-param>
</xsl:call-template>"
</xsl:if>
</xsl:template>
<xsl:template name='tex'>
<xsl:param name='s'/>
<xsl:choose>
<xsl:when test='string-length($s)>1 and $s!=',''>
<xsl:call-template name='tex'>
<xsl:with-param name='s'><xsl:value-of select='substring($s,1,1)'/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='tex'>
<xsl:with-param name='s'><xsl:value-of select='substring($s,2)'/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:when test='contains('"',$s)'>'</xsl:when>
<xsl:otherwise><xsl:value-of select='$s'/></xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet
version='1.0'
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:purl='http://purl.org/rss/1.0/'
xmlns:slash='http://purl.org/rss/1.0/modules/slash/'
xmlns:content='http://purl.org/rss/1.0/modules/content/'
xmlns:connotea='http://www.connotea.org/2005/01/schema#'
xmlns:dcterms='http://purl.org/dc/terms/'
xmlns:prism='http://prismstandard.org/namespaces/1.2/basic/'
xmlns:annotate='http://purl.org/rss/1.0/modules/annotate/'
xmlns:syn='http://purl.org/rss/1.0/modules/syndication/'
xmlns:dc='http://purl.org/dc/elements/1.1/'
xmlns:taxo='http://purl.org/rss/1.0/modules/taxonomy/'
xmlns:admin='http://webns.net/mvcb/'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='text' />
<xsl:template match='/'>
<xsl:apply-templates select='rdf:RDF'/>
</xsl:template>
<xsl:template match='rdf:RDF'>
<xsl:apply-templates select='purl:item'/>
</xsl:template>
<xsl:template match='purl:item'>
@ARTICLE{<xsl:value-of select='generate-id(.)'/>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>TITLE</xsl:with-param>
<xsl:with-param name='value'><xsl:value-of select='purl:title'/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>URL</xsl:with-param>
<xsl:with-param name='value'><xsl:value-of select='connotea:uri/dcterms:URI/@rdf:about'/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>author</xsl:with-param>
<xsl:with-param name='value'><xsl:for-each select='dcterms:URI/dc:creator'><xsl:value-of select='translate(.,',',' ')'/>,</xsl:for-each></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>journal</xsl:with-param>
<xsl:with-param name='value'><xsl:for-each select='dcterms:URI/prism:publicationName'><xsl:value-of select='translate(.,',',' ')'/>,</xsl:for-each></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>keywords</xsl:with-param>
<xsl:with-param name='value'><xsl:for-each select='dc:subject'><xsl:value-of select='translate(.,',',' ')'/><xsl:text> </xsl:text> </xsl:for-each></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='make-fied'>
<xsl:with-param name='key'>comment</xsl:with-param>
<xsl:with-param name='value'><xsl:value-of select='purl:description'/></xsl:with-param>
</xsl:call-template>
}
</xsl:template>
<xsl:template name='make-fied'>
<xsl:param name='key'/>
<xsl:param name='value'/>
<xsl:if test='string-length(normalize-space($value))>0'>
<xsl:text>,
</xsl:text>
<xsl:value-of select='$key'/>="<xsl:call-template name='tex'>
<xsl:with-param name='s'><xsl:value-of select='$value'/></xsl:with-param>
</xsl:call-template>"
</xsl:if>
</xsl:template>
<xsl:template name='tex'>
<xsl:param name='s'/>
<xsl:choose>
<xsl:when test='string-length($s)>1 and $s!=',''>
<xsl:call-template name='tex'>
<xsl:with-param name='s'><xsl:value-of select='substring($s,1,1)'/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name='tex'>
<xsl:with-param name='s'><xsl:value-of select='substring($s,2)'/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:when test='contains('"',$s)'>'</xsl:when>
<xsl:otherwise><xsl:value-of select='$s'/></xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Technorati Keywords: pubmed citeulike tagging bookmarking ncbi connotea xslt bioinformatics reference
You can go in the other direction, because CiteULike will export to EndNote format, which Connotea will upload.
ReplyDeleteIt therefore makes most sense to use CiteULike with Connotea as backup, but I like the Connotea interface better. My hope is that the two systems will soon play nice together.