<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE x:stylesheet [
<!ENTITY nav-fields "field[field_name='prev' or field_name='next' or field_name='contents' or field_name='index' or field_name='glossary' or field_name='copyright' or field_name='start' or field_name='chapter' or field_name='section' or field_name='subsection' or field_name='appendix' or field_name='help']/field_body" >
]>
<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="reST.xsl"/>
<x:param name="language" select="'en'"/>
<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>
<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:variable name="link-names-rtf">
<link rel="prev" lang="it">Precendente</link> <link rel="prev" lang="en">Previous</link>
<link rel="next" lang="it">Successivo</link> <link rel="next" lang="en">Next</link>
<link rel="contents" lang="it">Indice</link> <link rel="contents" lang="en">Contents</link>
<link rel="index" lang="it">Indice</link> <link rel="index" lang="en">Index</link>
<link rel="glossary" lang="it">Glossario</link> <link rel="glossary" lang="en">Glossary</link>
<link rel="copyright" lang="it">Copyright</link> <link rel="copyright" lang="en">Copyright</link>
<link rel="start" lang="it">Inizio</link> <link rel="start" lang="en">Start</link>
<link rel="chapter" lang="it">Capitolo</link> <link rel="chapter" lang="en">Chapter</link>
<link rel="section" lang="it">Sezione</link> <link rel="section" lang="en">Section</link>
<link rel="subsection" lang="it">Sotto-sezione</link> <link rel="subsection" lang="en">Subsection</link>
<link rel="appendix" lang="it">Appendice</link> <link rel="appendix" lang="en">Appendix</link>
<link rel="help" lang="it">Guida</link> <link rel="help" lang="en">Help</link>
</x:variable>
<x:variable name="link-names" select="e:node-set($link-names-rtf)/node()" />
<x:variable name="const-tr-rtf">
<t t="dates" l="it">Date</t> <t t="dates" l="en">Dates</t>
<t t="created" l="it">Creato: </t> <t t="created" l="en">Created: </t>
<t t="lastmod" l="it">Ultima modifica: </t> <t t="lastmod" l="en">Last modification: </t>
<t t="alt-lang" l="it">Altre lingue</t> <t t="alt-lang" l="en">Other languages</t>
<t t="en">English</t><t t="it">Italiano</t>
<t t="tags" l="it">Tag</t> <t t="tags" l="en">Tags</t>
<t t="navlinks" l="it">Documenti correlati</t> <t t="navlinks" l="en">Related documents</t>
<t t="navtags" l="it">Alcuni tag</t> <t t="navtags" l="en">Some tags</t>
<t t="alltags" l="it">Tutti i tag</t> <t t="alltags" l="en">All tags</t>
<t t="by" l="it"> di </t><t t="by" l="en"> by </t>
<t t="license" l="it"> è distribuito sotto una licenza </t><t t="license" l="en"> is distributed under the license </t>
<t t="comments" l="it">Per commenti, </t><t t="comments" l="en">If you have comments, </t>
<t t="mailsubj" l="it">Commenti su </t><t t="mailsubj" l="en">Comments on </t>
<t t="writeme" l="it">scrivetemi</t><t t="writeme" l="en">write me</t>
<t t="attention" l="it">Attenzione!</t> <t t="attention" l="en">Attention!</t>
<t t="caution" l="it">Cautela!</t> <t t="caution" l="en">Caution!</t>
<t t="danger" l="it">!PERICOLO!</t> <t t="danger" l="en">!DANGER!</t>
<t t="error" l="it">Errore</t> <t t="error" l="en">Error</t>
<t t="hint" l="it">Suggerimento</t> <t t="hint" l="en">Hint</t>
<t t="important" l="it">Importante</t> <t t="important" l="en">Important</t>
<t t="note" l="it">Nota</t> <t t="note" l="en">Note</t>
<t t="tip" l="it">Trucco</t> <t t="tip" l="en">Tip</t>
<t t="warning" l="it">Avvertenza</t> <t t="warning" l="en">Warning</t>
<t t="wishlist" l="it">Volete farmi un regalo? Qualche suggerimento su Amazon</t>
<t t="wishlist" l="en">Want to get me a present? Some suggestions on Amazon</t>
<t t="cgit" l="it">Progetti Software</t>
<t t="cgit" l="en">My Software Projects</t>
</x:variable>
<x:variable name="const-tr" select="e:node-set($const-tr-rtf)/node()" />
<x:output method="xml" encoding="utf-8"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
indent="yes"/>
<x:template match="system_message" />
<x:template match="*[@classes='system-messages']" />
<x:template match="reference">
<x:element name="a">
<x:attribute name="href">
<x:choose>
<x:when test="@refid">
<x:value-of select="concat('#', @refid)" />
</x:when>
<x:when test="@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($langs,ancestor::document/@source,@refuri)/node()"/>
</x:when>
<x:otherwise>
<x:apply-templates />
</x:otherwise>
</x:choose>
</x:element>
</x:template>
<x:template match="target[@refid and not(@refuri)]">
<a name="{@refid}">
<x:apply-templates/>
</a>
</x:template>
<x:template match="target[@ids and not(@refuri)]">
<x:variable name="this" select="."/>
<x:for-each select="s:split(@ids,' ')/token">
<a name="{.}">
<x:apply-templates select="$this/node()"/>
</a>
</x:for-each>
</x:template>
<x:template match="wc:title/title">
<x:copy-of select="parent::node()"/>
<x:apply-templates/>
</x:template>
<x:template match="*" mode="admonition-title">
<x:variable name="n" select="local-name()"/>
<x:value-of select="$const-tr[@t=$n and @l=$language]"/>
</x:template>
<x:template match="list_item/paragraph">
<p><x:apply-templates/></p>
</x:template>
<x:template match="list_item[count(paragraph)=1]/paragraph">
<x:apply-templates/>
</x:template>
<x:template match="field[field_name='feed']">
<x:variable name="url" select="normalize-space(string(field_body))"/>
<link rel="alternate" type="application/atom+xml" href="{$url}feed.{$language}.xml"/>
</x:template>
<x:template match="image[contains(concat(' ',normalize-space(@classes),' '),' twitter ')]" mode="twitter-card">
<x:variable name="uri-with-slash" select="wc:dst-uri-for(@uri,/document/@source)" />
<meta name="twitter:image" content="{substring($uri-with-slash,1,string-length($uri-with-slash) - 1)}" />
<x:if test="@alt">
<meta name="twitter:image:alt" content="{@alt}" />
</x:if>
</x:template>
<x:template match="image" mode="twitter-card" priority="-1" />
<x:template match="/document">
<html xml:lang="{$language}" lang="{$language}">
<head>
<title><x:value-of select="normalize-space(title)"/></title>
<x:apply-templates select="." mode="stylesheet" />
<link rel="icon" type="image/png" href="/favicon.png" />
<x:apply-templates select="docinfo/field[field_name='feed']"/>
<x:apply-templates select="docinfo" mode="nav-links" />
<x:if test="$path = ''">
<meta name="google-site-verification" content="NStibYPYcJWPVXEJMnjEOvQazfKubbaz3TrEi64my-Y" />
</x:if>
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@dakkar" />
<meta name="twitter:title" content="{normalize-space(title)}" />
<x:apply-templates select="//image" mode="twitter-card" />
<meta name="twitter:description">
<x:attribute name="content">
<x:choose>
<x:when test="subtitle">
<x:value-of select="normalize-space(subtitle)" />
</x:when>
<x:otherwise>
<x:variable name="content">
<x:apply-templates/>
</x:variable>
<x:value-of select="substring(normalize-space($content),0,200)"/>
<x:if test="string-length(normalize-space($content)) > 200">
<x:text>…</x:text>
</x:if>
</x:otherwise>
</x:choose>
</x:attribute>
</meta>
</head>
<body>
<div id="wrapper">
<div id="toplink">
<x:apply-templates select="." mode="top"/>
</div>
<div id="title">
<x:apply-templates select="." mode="title"/>
</div>
<div id="main-col">
<x:apply-templates select="." mode="topnav"/>
<div id="content">
<x:apply-templates select="." mode="content"/>
</div>
<x:apply-templates select="." mode="bottomnav"/>
</div>
<div id="sidebar">
<x:apply-templates select="." mode="sidebar"/>
</div>
<div id="push"></div>
</div>
<div id="footer">
<x:apply-templates select="." mode="footer"/>
</div>
</body>
</html>
</x:template>
<x:template match="/document/subtitle" />
<x:template match="/document" mode="top">
<a href="/"><img src="/logo.png" alt="thenautilus.net"/></a>
</x:template>
<x:template match="/document" mode="title">
<h1 class="title">
<x:apply-templates select="title/node()"/>
</h1>
<x:if test="subtitle">
<h2 class="subtitle">
<x:apply-templates select="subtitle/node()"/>
</h2>
</x:if>
</x:template>
<x:template match="/document" mode="stylesheet">
<x:apply-templates select="." mode="stylesheet-global"/>
<x:apply-templates select="." mode="stylesheet-local"/>
</x:template>
<x:template match="/document" mode="stylesheet-global">
<link rel="stylesheet" type="text/css" href="/layout.css" media="screen" />
<link rel="stylesheet" type="text/css" href="/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="/html4css1.css" />
<link rel="stylesheet" type="text/css" href="/content.css" />
</x:template>
<x:template match="/document" mode="stylesheet-local">
<x:for-each select="docinfo/field[field_name='css']/field_body/*/list_item|docinfo/field[field_name='css']/field_body/paragraph">
<link rel="stylesheet" type="text/css" href="{normalize-space(.)}" />
</x:for-each>
<x:for-each select="docinfo/field[field_name='inline-css']/field_body">
<style type="text/css">
<x:value-of select="." disable-output-escaping="yes" />
</style>
</x:for-each>
</x:template>
<x:template match="/document" mode="topnav">
<x:apply-templates select="docinfo" mode="tags" />
<x:apply-templates select="." mode="alternate-langs" />
</x:template>
<x:template match="/document" mode="content">
<x:apply-templates/>
</x:template>
<x:template match="/document" mode="bottomnav">
<x:apply-templates select="." mode="dates" />
</x:template>
<x:template match="/document" mode="sidebar">
<x:apply-templates select="." mode="navblock"/>
<x:apply-templates select="." mode="navtags"/>
<x:apply-templates select="." mode="twitter"/>
<x:apply-templates select="." mode="amazon"/>
</x:template>
<x:template match="/document" mode="navblock">
<x:apply-templates select="docinfo" mode="nav-block" />
</x:template>
<x:template match="/document" mode="navtags">
<div class="nav" id="nav-tags">
<span class="title"><x:value-of select="$const-tr[@t='navtags' and @l=$language]" /></span>
<ul>
<li><x:call-template name="taglink"><x:with-param name="tag">hardware</x:with-param></x:call-template></li>
<li><x:call-template name="taglink"><x:with-param name="tag">software</x:with-param></x:call-template></li>
<x:if test="$language = 'it'">
<li><x:call-template name="taglink"><x:with-param name="tag">racconti</x:with-param></x:call-template></li>
</x:if>
<li><x:call-template name="taglink"><x:with-param name="tag">viaggi</x:with-param></x:call-template></li>
<li><a href="/cgit/"><x:value-of select="$const-tr[@t='cgit' and @l=$language]"/></a></li>
</ul>
<a href="{wc:dst-uri-for('/tags/')}"><x:value-of select="$const-tr[@t='alltags' and @l=$language]"/></a>
<hr />
<a href="{wc:dst-uri-for('/contacts/')}"><x:apply-templates select="wc:title-for($language,$filename,'/contacts/')/node()" /></a>
</div>
</x:template>
<x:template match="/document" mode="twitter">
<a class="twitter-timeline"
data-dnt="true"
href="https://twitter.com/dakkar"
data-widget-id="545965003442900992"
data-chrome="nofooter transparent"
data-theme="dark"
>Tweets by @dakkar</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</x:template>
<x:template match="/document" mode="amazon">
<div id="amazon-wishlist">
<a href="//www.amazon.co.uk/registry/wishlist/INP247PNKQSZ">
<x:value-of select="$const-tr[@t='wishlist' and @l=$language]"/>
</a>
</div>
</x:template>
<x:template match="/document" mode="footer">
<x:apply-templates select="." mode="license"/>
<x:apply-templates select="." mode="contacts"/>
</x:template>
<x:template match="/document" mode="license">
<p class="license">
<a rel="license" href="//creativecommons.org/licenses/by-sa/2.5/it/">
<img alt="Creative Commons License" style="border-width:0" src="//i.creativecommons.org/l/by-sa/2.5/it/88x31.png" />
</a>
“<span xmlns:dc="http://purl.org/dc/elements/1.1/" href="//purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type">
<x:value-of select="normalize-space(/document/title)"/>
</span>”
<x:value-of select="$const-tr[@t='by' and @l=$language]"/>
<a xmlns:cc="http://creativecommons.org/ns#" href="mailto:dakkar@thenautilus.net" property="cc:attributionName" rel="cc:attributionURL">Gianni Ceccarelli</a>
<x:value-of select="$const-tr[@t='license' and @l=$language]"/>
<a rel="license" href="//creativecommons.org/licenses/by-sa/2.5/it/">Creative Commons By-SA 2.5 It</a>.
</p>
</x:template>
<x:template match="/document" mode="contacts">
<p class="contacts">
<x:value-of select="$const-tr[@t='comments' and @l=$language]"/>
<a href="mailto:dakkar@thenautilus.net?subject={s:encode-uri(concat($const-tr[@t='mailsubj' and @l=$language],normalize-space(string(/document/title))),false)}">
<x:value-of select="$const-tr[@t='writeme' and @l=$language]"/>
</a>.
</p>
</x:template>
<x:template name="taglink">
<x:param name="tag"/>
<a href="{wc:dst-uri-for(concat('/tags/',$tag,'/'))}">
<x:apply-templates select="wc:title-for($language,$filename,concat('/tags/',$tag,'/'))/node()"/>
</a>
</x:template>
<x:template match="/document" mode="dates">
<x:variable name="d" select="wc:dates-for($language,$filename,'./')/wc:dates"/>
<div id="dates">
<span class="title"><x:value-of select="$const-tr[@t='dates' and @l=$language]" /></span>
<span id="created">
<x:value-of select="$const-tr[@t='created' and @l=$language]" />
<span class="date created"><x:value-of select="$d/wc:creation-date"/></span>
</span>
<x:text> </x:text>
<span id="lastmod">
<x:value-of select="$const-tr[@t='lastmod' and @l=$language]" />
<span class="date lastmod"><x:value-of select="$d/wc:last-change"/></span>
</span>
</div>
</x:template>
<x:template match="/document" mode="alternate-langs">
<x:variable name="me" select="wc:dst-uri-for('.',/document/@source,1)" />
<x:variable name="alts">
<x:for-each select="wc:changes()/wc:changes/wc:document[@uri=$me]">
<x:variable name="l" select="@lang" />
<x:if test="$l != $language">
<li><a href="{$l}"><x:value-of select="$const-tr[@t=$l]"/></a></li>
</x:if>
</x:for-each>
</x:variable>
<x:if test="normalize-space($alts) != ''">
<div id="alt-langs">
<span class="title"><x:value-of select="$const-tr[@t='alt-lang' and @l=$language]" /></span>
<ul>
<x:copy-of select="$alts"/>
</ul>
</div>
</x:if>
</x:template>
<x:template match="/wc:tags">
<dl>
<x:apply-templates/>
</dl>
</x:template>
<x:template match="wc:tag">
<dt>
<span class="tag title">
<a href="{concat('/tags/',@name,'/')}">
<x:apply-templates select="wc:title-for($language,$filename,concat('/tags/',@name,'/'))/node()"/>
</a>
</span>
</dt>
<dd>
<ul>
<x:apply-templates/>
</ul>
</dd>
</x:template>
<x:template match="wc:doc">
<li>
<a class="tag doc" href="{@uri}"><x:apply-templates select="wc:title-for($language,$filename,@uri)/node()"/></a>
(<span class="tag doc langs"><x:apply-templates/></span>)
</li>
</x:template>
<x:template match="wc:lang">
<x:choose>
<x:when test=".!=$language">
<a href="{../@uri}{.}" class="lang"><x:value-of select="."/></a>
</x:when>
<x:otherwise>
<span class="lang"><x:value-of select="."/></span>
</x:otherwise>
</x:choose>
<x:if test="following-sibling::wc:lang"> | </x:if>
</x:template>
<x:template match="docinfo" mode="tags">
<x:variable name="tags">
<x:apply-templates select="field" mode="tags"/>
</x:variable>
<x:if test="normalize-space($tags) != ''">
<div id="tags">
<span class="title"><x:value-of select="$const-tr[@t='tags' and @l=$language]" /></span>
<ul>
<x:copy-of select="$tags" />
</ul>
</div>
</x:if>
</x:template>
<x:template match="field[field_name='tags']/field_body/*/list_item|field[field_name='tags']/field_body/paragraph" mode="tags">
<x:variable name="tag-name"><x:value-of select="normalize-space(.)"/></x:variable>
<li>
<span class="tag">
<a href="{concat('/tags/',$tag-name,'/')}">
<x:apply-templates select="wc:title-for($language,$filename,concat('/tags/',$tag-name,'/'))/node()"/>
</a>
</span>
</li>
</x:template>
<x:template match="field[field_name != 'tags']" mode="tags" priority="-1" />
<x:template match="field_name" mode="tags" priority="-1" />
<x:template match="docinfo" mode="nav-block">
<x:variable name="links">
<x:apply-templates select="field" mode="nav-block"/>
</x:variable>
<x:if test="normalize-space($links) != ''">
<div class="nav" id="nav-links">
<span class="title"><x:value-of select="$const-tr[@t='navlinks' and @l=$language]" /></span>
<dl>
<x:copy-of select="$links" />
</dl>
</div>
</x:if>
</x:template>
<x:template match="&nav-fields;" mode="nav-block">
<x:variable name="rel"><x:value-of select="normalize-space(parent::field/field_name)" /></x:variable>
<x:variable name="label">
<x:copy-of select="$link-names[@rel=$rel and @lang=$language]/node()" />
</x:variable>
<dt class="nav-link-{$rel}">
<x:copy-of select="$label"/><x:text>: </x:text>
</dt>
<dd class="nav-link-{$rel}">
<a class="nav-link-{$rel}" href="{normalize-space(.)}">
<x:apply-templates select="wc:title-for($langs,ancestor::document/@source,normalize-space(.))/node()"/>
</a>
</dd>
</x:template>
<x:template match="field/field_name|field/field_body" mode="nav-block" priority="-1" />
<x:template match="&nav-fields;" mode="nav-links">
<link rel="{normalize-space(parent::field/field_name)}"
href="{normalize-space(.)}"
title="{normalize-space(wc:title-for($langs,ancestor::document/@source,normalize-space(.)))}"
/>
</x:template>
<x:template match="field/field_name|field/field_body" mode="nav-links" priority="-1" />
</x:stylesheet>