Skip to content

Instantly share code, notes, and snippets.

@terrywbrady
Created October 3, 2016 23:25
Show Gist options
  • Save terrywbrady/d0304eed59815d2e9c2d658a21cc5628 to your computer and use it in GitHub Desktop.
Save terrywbrady/d0304eed59815d2e9c2d658a21cc5628 to your computer and use it in GitHub Desktop.
Show Orcid with XMLUI
<!--
display item summary info
$notLast and $sep are used to control the display of multiple authors
-->
<xsl:when test="@element='contributor' and @qualifier='author' and @authority">
<xsl:variable name="a">
<xsl:value-of select="."/>
<xsl:call-template name="ORCID">
<xsl:with-param name="uuid" select='@authority'/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="b">
<xsl:if test="$notLast"><xsl:copy-of select="$sep"/></xsl:if>
</xsl:variable>
<xsl:copy-of select="$a"/><xsl:copy-of select="$b"/>
</xsl:when>
<!-- create a link to ORCID using the SOLR authority -->
<xsl:template name="ORCID">
<xsl:param name='uuid'/>
<xsl:variable name="solr" select="concat('http://localhost/solr/authority/select?q=id:',$uuid)"/>
<xsl:variable name="authority" select="document($solr)/response/result/doc/str[@name='orcid_id']/text()"/>
<xsl:if test="$authority">
<xsl:text> (</xsl:text>
<a>
<xsl:attribute name='href'>
<xsl:value-of select="concat('http://orcid.org/',$authority)"/>
</xsl:attribute>
<xsl:text>ORCID</xsl:text>
</a>
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment