assets/index.xsl in cobench-0.0.7 vs assets/index.xsl in cobench-0.0.8
- old
+ new
@@ -22,11 +22,10 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output encoding="UTF-8" method="html"/>
- <xsl:key name="metrics" match="/cobench/coders/coder/metrics/m" use="@id"/>
<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>cobench</title>
@@ -58,11 +57,14 @@
<p>
<img src="https://raw.githubusercontent.com/yegor256/cobench/master/logo.svg" style="width:64px"/>
</p>
</header>
<article>
- <xsl:apply-templates select="cobench/coders"/>
+ <table id="metrics">
+ <xsl:apply-templates select="cobench/titles"/>
+ <xsl:apply-templates select="cobench/coders"/>
+ </table>
</article>
<footer>
<p>
<xsl:text>The page was generated by </xsl:text>
<a href="https://github.com/yegor256/cobench">
@@ -83,42 +85,53 @@
</footer>
</section>
</body>
</html>
</xsl:template>
+ <xsl:template match="cobench/titles">
+ <thead>
+ <tr>
+ <th/>
+ <xsl:for-each select="title">
+ <xsl:sort select="."/>
+ <th class="sorter num">
+ <xsl:value-of select="."/>
+ </th>
+ </xsl:for-each>
+ </tr>
+ </thead>
+ </xsl:template>
<xsl:template match="cobench/coders">
- <table id="metrics">
- <thead>
- <tr>
- <th/>
- <xsl:for-each select="coder/metrics/m[generate-id() = generate-id(key('metrics', @id)[1])]">
- <th class="sorter num">
- <xsl:value-of select="@id"/>
- </th>
- </xsl:for-each>
- </tr>
- </thead>
- <tbody>
- <xsl:apply-templates select="coder"/>
- </tbody>
- </table>
+ <tbody>
+ <xsl:apply-templates select="coder"/>
+ </tbody>
</xsl:template>
<xsl:template match="coder">
<tr>
<td>
<a href="https://github.com/{@id}">
<xsl:text>@</xsl:text>
<xsl:value-of select="@id"/>
</a>
</td>
- <xsl:apply-templates select="metrics/m"/>
+ <xsl:for-each select="metrics/m">
+ <xsl:sort select="@id"/>
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
</tr>
</xsl:template>
<xsl:template match="m">
<td class="num">
- <a href="{@href}">
- <xsl:value-of select="."/>
- </a>
+ <xsl:choose>
+ <xsl:when test="@href">
+ <a href="{@href}">
+ <xsl:value-of select="."/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
</td>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>