<?xml version="1.0" encoding="utf-8"?>
<x:stylesheet xmlns:x="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:e="http://exslt.org/common"
xmlns:s="http://exslt.org/strings"
xmlns:wc="http://webcoso.thenautilus.net/"
exclude-result-prefixes="wc e s"
version="1.0"
>
<x:import href="du2html.xsl" />
<x:variable name="const-local-rtf">
<t t="rating" l="it">Voto: </t> <t t="rating" l="en">Rating: </t>
<t t="original" l="it">Questa recensione è stata pubblicata originariamente presso: </t>
<t t="original" l="en">This review was originally published at: </t>
</x:variable>
<x:variable name="const-local" select="e:node-set($const-local-rtf)/node()" />
<x:template match="/document" mode="title">
<x:variable name="rating" select="/document/docinfo/field[field_name='rating']/field_body"/>
<x:apply-imports/>
<h2 class="rating">
<x:value-of select="$const-local[@t='rating' and @l=$language]"/>
<span class="rating-value"><x:value-of select="$rating"/></span>
<span class="rating-img">
<x:call-template name="star-sequence">
<x:with-param name="value" select="number($rating)"/>
<x:with-param name="max" select="5"/>
</x:call-template>
</span>
</h2>
</x:template>
<x:template match="/document" mode="stylesheet-global">
<x:apply-imports/>
<link rel="stylesheet" type="text/css" href="/reviews.css" />
</x:template>
<x:template match="/document" mode="bottomnav">
<x:apply-templates select="." mode="original-review"/>
<x:apply-imports/>
</x:template>
<x:template match="/document" mode="original-review">
<x:variable name="link" select="/document/docinfo/field[field_name='original']/field_body"/>
<x:if test="string-length($link) > 0">
<div id="original-review">
<x:value-of select="$const-local[@t='original' and @l=$language]"/>
<a href="{$link}"><x:value-of select="$link"/></a>
</div>
</x:if>
</x:template>
<x:template name="star-sequence">
<x:param name="value"/>
<x:param name="max"/>
<x:choose>
<x:when test="$value >= 1"><img src="/full-star.svg" style="width: 2em; height: 2em" /></x:when>
<x:when test="$value > 0"><img src="/half-star.svg" style="width: 2em; height: 2em" /></x:when>
<x:otherwise><img src="/empty-star.svg" style="width: 2em; height: 2em" /></x:otherwise>
</x:choose>
<x:if test="$max > 1">
<x:call-template name="star-sequence">
<x:with-param name="value" select="$value - 1"/>
<x:with-param name="max" select="$max - 1"/>
</x:call-template>
</x:if>
</x:template>
</x:stylesheet>