Skip to content

Instantly share code, notes, and snippets.

@tts
Last active December 15, 2015 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tts/5268732 to your computer and use it in GitHub Desktop.
Save tts/5268732 to your computer and use it in GitHub Desktop.
Transform an XML file with a sample of Aalto publications sorted by WoS citation scores to a jQuery Mobile framework HTML5 file with the ImpactStory JavaScript widget.
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="2.0">
<!--
xml2html5jqmwithalt.xsl
Tuija Sonkkila 28.3.2013
Transform an XML file to a jQuery Mobile framework HTML5 file with
the ImpactStory altmetrics JavaScript widget. For the making of the
source XML file, see https://gist.github.com/tts/5268693
java -jar saxon8he.jar -xsl:xml2html5jqmwithalt.xsl -s:pubs.xml -o:alt.html
-->
<xsl:output method="html" indent="yes"/>
<xsl:variable name="baseurl" select="'http://dx.doi.org/'"/>
<xsl:template match="/">
<html>
<head>
<title>ImpactStory altmetrics for a sample of Aalto publications</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0-alpha.1/jquery.mobile-1.2.0-alpha.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0-alpha.1/jquery.mobile-1.2.0-alpha.1.min.js"></script>
<script type="text/javascript" src="http://impactstory.org/embed/v1/impactstory.js"></script>
</head>
<body class="home">
<div data-role="page" data-theme="c" id="home">
<div data-role="header">
<h1>Altmetrics by ImpactStory</h1>
</div> <!-- header -->
<div data-role="content">
<!-- Acronyms of Aalto Schools -->
<ul data-role="listview" data-inset="true">
<li><a href="#ARTS">ARTS</a></li>
<li><a href="#BIZ">BIZ</a></li>
<li><a href="#CHEM">CHEM</a></li>
<li><a href="#ELEC">ELEC</a></li>
<li><a href="#ENG">ENG</a></li>
<li><a href="#SCI">SCI</a></li>
</ul>
</div> <!-- content -->
</div> <!-- page -->
<xsl:for-each-group select="pubs/pub" group-by="school">
<div data-role="page" data-theme="c" id="{current-grouping-key()}">
<div data-role="header">
<h1><xsl:value-of select="current-grouping-key()"/></h1>
<a href="alt.html" data-icon="home" data-iconpos="notext">Home</a>
</div> <!-- header -->
<div data-role="content">
<ul data-role="listview">
<xsl:for-each select="current-group()">
<xsl:variable name="doi" select="doi"/>
<li>
<p><xsl:value-of select="year"/></p>
<p><strong><xsl:value-of select="title"/></strong></p>
<p><xsl:value-of select="cites"/><xsl:text> WoS cites</xsl:text></p>
<p><a target="_blank">
<xsl:attribute name="href"><xsl:value-of select="concat($baseurl, $doi)"/></xsl:attribute>
<xsl:value-of select="$doi"/></a>
</p>
<p class="ui-li-aside">
<span class="impactstory-embed impactstory-small impactstory-tag impactstory-color"
data-show-logo="false" data-badge-size="small" data-id="{$doi}" data-id-type="doi"
data-api-key="[put your ImpactStory key here"></span>
</p>
</li>
</xsl:for-each>
</ul>
</div> <!-- content -->
</div> <!-- page -->
</xsl:for-each-group>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment