summaryrefslogtreecommitdiff
path: root/templates/du2html-review.xsl
blob: 5fe3c1e15d1fd2dc8ff331a541cda0c32680d639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?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) &gt; 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 &gt;= 1"><img src="/full-star.svg" style="width: 2em; height: 2em" /></x:when>
   <x:when test="$value &gt; 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 &gt; 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>