Created
October 28, 2018 16:27
-
-
Save syranez/ac21058d6c5531bb17cce7801310924c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet | |
version="1.1" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns="http://www.w3.org/1999/xhtml"> | |
<xsl:output method="xml" indent="yes" encoding="UTF-8"/> | |
<xsl:template match="/season"> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title> | |
<xsl:value-of select="@team" /> | |
<xsl:text>-</xsl:text> | |
<xsl:value-of select="@name" /> | |
</title> | |
<link rel="stylesheet" type="text/css" href="assets/sheet.css" /> | |
</head> | |
<body> | |
<div class="container"> | |
<xsl:apply-templates select="match"> | |
</xsl:apply-templates> | |
</div> | |
</body> | |
</html> | |
</xsl:template> | |
<xsl:template match="match"> | |
<div> | |
<xsl:variable name="state"> | |
<xsl:choose> | |
<xsl:when test="result/team = ''"> | |
<xsl:value-of select="'coming'" /> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:choose> | |
<xsl:when test="result/team > result/opponent"> | |
<xsl:value-of select="'win'" /> | |
</xsl:when> | |
<xsl:when test="result/team = result/opponent"> | |
<xsl:value-of select="'draw'" /> | |
</xsl:when> | |
<xsl:when test="result/team < result/opponent"> | |
<xsl:value-of select="'loss'" /> | |
</xsl:when> | |
</xsl:choose> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:variable> | |
<xsl:attribute name="class">termin <xsl:value-of select="$state" /></xsl:attribute> | |
<xsl:apply-templates/> | |
</div> | |
</xsl:template> | |
<xsl:template match="competition"> | |
<div class="competition"> | |
<span><xsl:value-of select="." /></span> | |
</div> | |
</xsl:template> | |
<xsl:template match="result"> | |
<div class="result"> | |
<span> | |
<xsl:if test="team != ''"> | |
<xsl:value-of select="team" /> | |
<xsl:text>:</xsl:text> | |
<xsl:value-of select="opponent" /> | |
</xsl:if> | |
</span> | |
</div> | |
</xsl:template> | |
<xsl:template match="opponent"> | |
<div class="opponent"> | |
<span> | |
<xsl:value-of select="." /> | |
</span> | |
</div> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment