diff options
Diffstat (limited to 'templates/du2html.xsl')
-rw-r--r-- | templates/du2html.xsl | 67 |
1 files changed, 54 insertions, 13 deletions
diff --git a/templates/du2html.xsl b/templates/du2html.xsl index d98ce0e..29d1cbb 100644 --- a/templates/du2html.xsl +++ b/templates/du2html.xsl @@ -1,7 +1,9 @@ <?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:wc="http://webcoso.thenautilus.net/" + exclude-result-prefixes="wc e" version="1.0" > @@ -11,11 +13,38 @@ <x:param name="path"/> <x:param name="filename"/> + <x:variable name="langs-rtf"> + <x:choose> + <x:when test="$language = 'it'"> + <lang>it</lang> + <lang>en</lang> + </x:when> + <x:when test="$language = 'en'"> + <lang>en</lang> + <lang>it</lang> + </x:when> + <x:otherwise> <!-- uh? --> + <lang><x:value-of select="$language"/></lang> + </x:otherwise> + </x:choose> + </x:variable> + <x:variable name="langs" select="e:node-set($langs-rtf)/node()"/> + <x:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" indent="yes"/> <x:template match="system_message" /> + <x:template match="*[@classes='system-messages']" /> + + <!-- + i casini con quel ancestor::document sono dovuti a: + + 1) il fatto che $filename non รจ il nome del documento che stiamo + toccando, quando espandiamo i documenti dentro al feed + + 2) un bug di LibXML o LibXSLT, per cui /document/@source non va + --> <x:template match="reference"> <x:element name="a"> @@ -25,14 +54,14 @@ <x:value-of select="concat('#', @refid)" /> </x:when> <x:when test="@refuri"> - <x:value-of select="@refuri" /> + <x:value-of select="@refuri"/> </x:when> </x:choose> </x:attribute> <x:choose> <x:when test="@refuri and string(.)=string(@refuri)"> - <x:apply-templates select="wc:title-for($language,$filename,@refuri)"/> + <x:apply-templates select="wc:title-for($langs,ancestor::document/@source,@refuri)"/> </x:when> <x:otherwise> <x:apply-templates /> @@ -41,6 +70,9 @@ </x:element> </x:template> + <!-- qui ce ne freghiamo del @source, tanto viene usata solo per i + documenti stand-alone --> + <x:template match="/document"> <html xml:lang="{$language}" lang="{$language}"> <head> @@ -71,24 +103,33 @@ </x:template> <x:template match="/wc:dates"> - <span id="created">Creato: <span class="date created"><x:value-of select="wc:creation-date"/></span></span><x:text> </x:text> - <span id="lastmod">Ultima modifica: <span class="date lastmod"><x:value-of select="wc:last-change"/></span></span> + <span id="created"> + <x:if test="$language='it'">Creato: </x:if> + <x:if test="$language='en'">Created: </x:if> + <span class="date created"><x:value-of select="wc:creation-date"/></span> + </span> + <x:text> </x:text> + <span id="lastmod"> + <x:if test="$language='it'">Ultima modifica: </x:if> + <x:if test="$language='en'">Last change: </x:if> + <span class="date lastmod"><x:value-of select="wc:last-change"/></span> + </span> </x:template> <x:template match="/wc:tags"> - <dl> + <ul> <x:apply-templates/> - </dl> + </ul> </x:template> <x:template match="wc:tag"> - <x:value-of select="wc:message('wc:tag',.)"/> - <dt><span class="tag title"><x:apply-templates select="wc:title-for($language,$filename,concat('/tags/',@name,'/'))"/></span></dt> - <dd> - <ul> - <x:apply-templates/> - </ul> - </dd> + <li> + <span class="tag title"> + <a href="{concat('/tags/',@name,'/')}"> + <x:apply-templates select="wc:title-for($language,$filename,concat('/tags/',@name,'/'))"/> + </a> + </span> + </li> </x:template> <x:template match="wc:doc"> |