<?xml version=„1.0“ encoding=„utf-8“?> <xsl:stylesheet

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>

<xsl:template match="/">
	<!-- this allows nesting results element arbitrarily -->
	<xsl:apply-templates select="//results"></xsl:apply-templates>
</xsl:template>

<xsl:template match="results">
	<xsl:apply-templates select="detail"></xsl:apply-templates>
</xsl:template>

<xsl:template match="cumulative">
	<xsl:apply-templates select="category">
		<xsl:sort select="@id" order="descending"/>
	</xsl:apply-templates>
</xsl:template>
<xsl:template match="detail">
	<xsl:apply-templates select="category">
		<xsl:sort select="@id" order="descending"/>
	</xsl:apply-templates>
</xsl:template>

  <xsl:template match="category">
	<h2>Category of study year <xsl:value-of select="@id"/></h2><!-- here should be a named template -->
	<table class="table table-hover table-striped table-sm">
		<col align="right" class="poradi" />
		<col class="jmeno" />
		<col class="skola" />
			<xsl:element name="col">
				<xsl:attribute name="span"><xsl:value-of select="count(column-definitions/column-definition)-1"/></xsl:attribute>
				<xsl:attribute name="align">right</xsl:attribute>
				<xsl:attribute name="class">body</xsl:attribute>
			</xsl:element>
			<col align="right" class="celkem" />
		<thead><tr>
       	<th></th><th>Name</th><th>School</th>
       	<xsl:apply-templates select="column-definitions/column-definition" mode="header"></xsl:apply-templates>
		</tr></thead>
		
		<tr class="student_pilny static staticRow">
        <td></td><td>Student Hardworking</td><td>MFF UK</td>
        <xsl:apply-templates select="column-definitions/column-definition" mode="limit"></xsl:apply-templates>
		</tr>
                      
		
		<xsl:apply-templates select="data/contestant"></xsl:apply-templates>
	</table>
  </xsl:template>
  
<xsl:template match="column-definition" mode="header">
	<th>
	<xsl:choose>
		<xsl:when test="@label = 'percent'">%</xsl:when>
		<xsl:when test="@label = 'sum'">&#8721;</xsl:when>						
		<xsl:otherwise><xsl:value-of select="@label"/></xsl:otherwise>
	</xsl:choose>
	</th>
</xsl:template>

<xsl:template match="column-definition" mode="limit">
	<td>
		<xsl:choose>
			<xsl:when test="position() = last()">
				<b><xsl:call-template name="nullable"><xsl:with-param name="value" select="@limit"/></xsl:call-template></b>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="nullable"><xsl:with-param name="value" select="@limit"/></xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</td>
</xsl:template>

<xsl:template match="column" mode="contestant">
	<td>
		<!-- Sets class to those cells, where the value is greater than Student's Pilny value -->
		<!-- Added by Stepan Stenchlak <stenchlak@fykos.cz> in January 2019 -->
		<xsl:variable name="column_position" select="position()" />
		<xsl:if test="ancestor::category/column-definitions/column-definition[$column_position]/@limit &lt; text()">
			<xsl:attribute name="style">font-weight: bold; color: #da1175;</xsl:attribute>
		</xsl:if>
		<xsl:choose>
			<xsl:when test="position() = last()">
				<b><xsl:call-template name="nullable"><xsl:with-param name="value" select="text()"/></xsl:call-template></b>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="nullable"><xsl:with-param name="value" select="text()"/></xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</td>
</xsl:template>

<xsl:template match="contestant">
	<xsl:if test="column[last()]/text()">
	<tr>
		<td align='right'>
			<xsl:if test="rank/@to"><xsl:value-of select="rank/@from"/>.&#8211;<xsl:value-of select="rank/@to"/>.</xsl:if>
			<xsl:if test="not(rank/@to)"><xsl:value-of select="rank/@from"/>.</xsl:if>
		</td>
		<td>
			<xsl:value-of select="@name"/>
		</td>
		<td>
			<xsl:value-of select="@school"/>
		</td>
		<xsl:apply-templates select="column" mode="contestant"></xsl:apply-templates>
	</tr>
</xsl:if>
</xsl:template>

<xsl:template name="nullable">
	<xsl:param name="value"/>
	<xsl:if test="not($value)">&#8211;</xsl:if>
	<xsl:if test="$value"><xsl:value-of select="$value"/></xsl:if>
</xsl:template>

</xsl:stylesheet>

Tato stránka využívá cookies pro analýzu provozu. Používáním stránky souhlasíte s ukládáním těchto cookies na vašem počítači.Více informací

Pořadatelé a partneři

Pořadatel

Pořadatel MSMT_logotyp_text_cz

Generální partner

Partner

Partner

Mediální partner


Created with <love/> by ©FYKOS – webmaster@fykos.cz