diff options
author | dakkar <dakkar@thenautilus.net> | 2012-09-23 18:56:07 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2012-09-23 20:37:21 +0100 |
commit | 9c9a41ce0d3773040d4b9a62c4c99c62196c418d (patch) | |
tree | c3e3ab1d1ef1ae9c3d1fd66e8ae5bcb9e39573a3 /templates/du2html-review.xsl | |
parent | anime bump (diff) | |
download | thenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.tar.gz thenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.tar.bz2 thenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.zip |
infrastructure for reviews
Diffstat (limited to 'templates/du2html-review.xsl')
-rw-r--r-- | templates/du2html-review.xsl | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/templates/du2html-review.xsl b/templates/du2html-review.xsl new file mode 100644 index 0000000..b190c59 --- /dev/null +++ b/templates/du2html-review.xsl @@ -0,0 +1,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) > 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>
\ No newline at end of file |