ayerh.art/xslt/mb-collection.xsl

81 lines
2.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:mb="http://musicbrainz.org/ns/mmd-2.0#"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="mb">
<xsl:output method="html" encoding="utf-8" indent="yes"/>
<xsl:variable name="mb-base-url">https://musicbrainz.org</xsl:variable>
<xsl:variable name="ca-base-url">https://coverartarchive.org/release</xsl:variable>
<xsl:variable name="static-bbb-base-url">https://static.bonerbonerboner.com</xsl:variable>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
<link rel="stylesheet" href="./music.css"/>
<title><xsl:value-of select="mb:metadata/mb:collection/mb:name"/></title>
</head>
<body>
<h1><xsl:value-of select="mb:metadata/mb:collection/mb:name"/></h1>
<nav class="crumbs">
<ol>
<li class="crumb"><a href="/">Ayerhart Music Collections</a></li>
<li class="crumb"><xsl:value-of select="mb:metadata/mb:collection/mb:name"/></li>
</ol>
</nav>
<xsl:apply-templates select="mb:metadata/mb:collection"/>
</body>
</html>
</xsl:template>
<xsl:template match="mb:collection">
<div id="{@id}" class="{local-name()}">
<xsl:apply-templates select="mb:release-list"/>
</div>
</xsl:template>
<xsl:template match="mb:release-list">
<div class="albums">
<xsl:apply-templates select="mb:release">
<xsl:sort select="mb:artist-credit/mb:name-credit/mb:artist/mb:sort-name" data-type="text"/>
</xsl:apply-templates>
</div>
</xsl:template>
<xsl:template match="mb:artist-credit">
<h3 class="artist">
<a id="{mb:name-credit/mb:artist/mb:sort-name}-{mb:name-credit/mb:artist/@id}"
href="{$mb-base-url}/artist/{mb:name-credit/mb:artist/@id}"
class="name">
<xsl:value-of select="mb:name-credit/mb:artist/mb:name"/>
</a>
</h3>
</xsl:template>
<xsl:template match="mb:release">
<div class="album">
<div class="album-info">
<h2 class="title"><a href="{$mb-base-url}/release/{@id}"><xsl:value-of select="mb:title"/></a></h2>
<span class="underline"/>
<xsl:apply-templates select="mb:artist-credit"/>
</div>
<div class="cover-art">
<a href="{$mb-base-url}/release/{@id}">
<img src="https://coverartarchive.org/release/{@id}/front"
onerror="this.error=null;this.src='https://static.bonerbonerboner.com/img/tromboner.gif';"/>
</a>
</div>
</div>
</xsl:template>
</xsl:stylesheet>