guide-libreasso/tools/xslt/guide-html.xsl

253 lines
9.8 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="html">
<!--<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>-->
<xsl:output method="html"/>
<xsl:variable name="CONF" select="/conf"/>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;
</xsl:text>
<html lang="fr">
<head>
<meta name="description" content="Guide Libre Association, des logiciels pour libérer votre projet associatif" />
<meta name="version" content="1.1" />
<title>Guide Libre Association</title>
<link rel="shortcut icon" href= "http://www.april.org/sites/default/themes/zen_april/favicon.ico" />
<link type="text/css" rel="stylesheet" href="css/layout-default-latest.css" />
<link type="text/css" rel="stylesheet" href="css/guide.css" />
<script type="text/javascript" src="js/jquery-latest.js"></script>
<script type="text/javascript" src="js/jquery-ui-latest.js"></script>
<script type="text/javascript" src="js/jquery.layout-latest.js"></script>
<script type="text/javascript" src="js/jquery.lightbox-adapte.js"></script>
<script type="text/javascript" src="js/guide.js"></script>
</head>
<body>
<div class="ui-layout-north">
<a href="/">
<div class="guide_logos">
<img src="images/logo_libreassociation.png" alt="logo libreassociation"/>
<img src="images/logo_fondation_creditcoop.png" alt="logo fondation credit coop"/>
<img src="images/logo_april.png" alt="logo april"/>
</div>
</a>
<p class="entete_titre">Guide Libre Association</p>
<p class="entete_soustitre">Des logiciels pour libérer votre projet associatif</p>
<p style="float:right" class="entete_soustitre"><a href="/includes/guide-libre-association-version-1.1.pdf">Version PDF du guide</a></p>
</div>
<div class="ui-layout-west">
<xsl:apply-templates select="conf/toc" mode="_Recuperation"/>
</div>
<div class="ui-layout-center content">
<p class="contenu_titre">Guide Libre Association</p>
<p class="contenu_soustitre">Des logiciels pour libérer votre projet associatif</p>
<article>
<xsl:apply-templates select="conf/chapitre" mode="_Recuperation"/>
</article>
</div>
<!--div class="ui-layout-south">
<hr size="2" />
<blockquote class="quote"><em>Ce document a été traduit de
L<sup>A</sup>T<sub>E</sub>X par</em> <a href=
"http://hevea.inria.fr"><em>H</em><em><font size=
"2"><sup>E</sup></font></em><em>V</em><em><font size=
"2"><sup>E</sup></font></em><em>A</em></a></blockquote>
</div>-->
</body>
</html>
</xsl:template>
<xsl:template match="*" mode="_Recuperation">
<xsl:variable name="var_Href" select="@href"/>
<xsl:variable name="var_Body" select="document($var_Href)/html:html/html:body"/>
<xsl:apply-templates select="$var_Body/*" mode="_Copy"/>
</xsl:template>
<!-- l'appel à xsl:element plutôt que xsl:copy permet de supprimer la référence à l'espace de nom html -->
<xsl:template match="*" mode="_Copy">
<xsl:variable name="var_Class" select="@class"/>
<xsl:variable name="var_Id" select="@id"/>
<xsl:element name="{local-name()}">
<xsl:if test="$var_Id"><xsl:attribute name="id"><xsl:value-of select="$var_Id"/></xsl:attribute></xsl:if>
<xsl:if test="$var_Class"><xsl:attribute name="class"><xsl:value-of select="$var_Class"/></xsl:attribute></xsl:if>
<xsl:apply-templates select="node()" mode="_Copy"/>
</xsl:element>
</xsl:template>
<xsl:template match="text()" mode="_Copy">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="html:a" mode="_Copy">
<xsl:variable name="var_Class" select="@class"/>
<xsl:variable name="var_Id" select="@id"/>
<xsl:variable name="var_Href" select="@href"/>
<a>
<xsl:if test="$var_Id"><xsl:attribute name="id"><xsl:value-of select="$var_Id"/></xsl:attribute></xsl:if>
<xsl:if test="$var_Class"><xsl:attribute name="class"><xsl:value-of select="$var_Class"/></xsl:attribute></xsl:if>
<xsl:if test="$var_Href"><xsl:attribute name="href">
<xsl:choose>
<xsl:when test="starts-with($var_Href, 'guide')">#<xsl:value-of select="substring-after($var_Href, '#')"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$var_Href"/></xsl:otherwise>
</xsl:choose>
</xsl:attribute></xsl:if>
<xsl:apply-templates select="node()" mode="_Copy"/>
</a>
</xsl:template>
<xsl:template match="html:br" mode="_Copy">
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="html:img" mode="_Copy">
<xsl:variable name="var_Class" select="@class"/>
<xsl:variable name="var_Id" select="@id"/>
<xsl:variable name="var_Src" select="@src"/>
<img>
<xsl:if test="$var_Id"><xsl:attribute name="id"><xsl:value-of select="$var_Id"/></xsl:attribute></xsl:if>
<xsl:if test="$var_Class"><xsl:attribute name="class"><xsl:value-of select="$var_Class"/></xsl:attribute></xsl:if>
<xsl:if test="$var_Src"><xsl:attribute name="src">../src/<xsl:value-of select="$var_Src"/></xsl:attribute></xsl:if>
</img>
</xsl:template>
<!-- div contenant les captures d'écran -->
<xsl:template match="html:div[@class='guide_capture']" mode="_Copy">
<div class="guide_capture">
<xsl:apply-templates select="html:a" mode="_Capture"/>
</div>
</xsl:template>
<xsl:template match="html:a" mode="_Capture">
<xsl:variable name="var_Class" select="@class"/>
<xsl:variable name="var_Href" select="@href"/>
<xsl:variable name="var_Alt" select="../text()"/>
<a class="{$var_Class}" href="../src/{$var_Href}" title="{$var_Alt}">
<xsl:apply-templates select="html:img" mode="_Capture"/>
</a>
<p><xsl:value-of select="$var_Alt"/></p>
</xsl:template>
<xsl:template match="html:img" mode="_Capture">
<xsl:variable name="var_Alt" select="../../text()"/>
<img class="{@class}" src="../src/{@src}" alt="{$var_Alt}"/>
</xsl:template>
<xsl:template match="html:div[@class='guide_encart' and starts-with(@title, 'À')]" mode="_Copy" priority="10">
<div class="guide_encartdefin">
<div class="guide_encart_titre"><xsl:value-of select="@title"/></div>
<div class="guide_encart_contenu">
<p><xsl:apply-templates select="node()" mode="_Filtre"/></p>
<xsl:apply-templates select="html:p" mode="_Copy"/>
</div>
</div>
</xsl:template>
<xsl:template match="html:div[@class='guide_encart']" mode="_Copy">
<aside>
<div class="guide_encart">
<div class="guide_encart_titre"><xsl:value-of select="@title"/></div>
<div class="guide_encart_contenu">
<p><xsl:apply-templates select="node()" mode="_Filtre"/></p>
<xsl:apply-templates select="html:p" mode="_Copy"/>
</div>
</div>
</aside>
</xsl:template>
<xsl:template match="node()" mode="_Filtre">
<xsl:apply-templates select="." mode="_Copy"/>
</xsl:template>
<xsl:template match="html:p" mode="_Filtre">
</xsl:template>
<xsl:template match="html:div[@class='guide_logiciel']" mode="_Copy">
<aside><div class="guide_logiciel">
<xsl:apply-templates select="node()" mode="_Copy"/>
</div></aside>
</xsl:template>
<xsl:template match="html:div[@class='guide_ressource']" mode="_Copy">
<aside><div class="guide_ressource">
<div class="guide_ressource_titre">Pour aller plus loin</div>
<div class="guide_ressource_contenu">
<xsl:apply-templates select="node()" mode="_CopyRessource"/>
</div>
</div></aside>
</xsl:template>
<xsl:template match="node()" mode="_CopyRessource">
<xsl:apply-templates select="." mode="_Copy"/>
</xsl:template>
<xsl:template match="html:p" mode="_CopyRessource">
<br/>
<xsl:apply-templates select="node()" mode="_Copy"/>
</xsl:template>
<xsl:template match="html:div[@class='guide_apprentissage']" mode="_Copy">
<xsl:variable name="var_Text" select="string(.)"/>
<div class="guide_apprentissage">
<span>Apprentissage&#x00A0;:</span>
<img src="images/guide_hirondelle_active.png" alt="Hirondelle"/>
<xsl:choose>
<xsl:when test="$var_Text = '***'">
<img src="images/guide_hirondelle_active.png" alt="Hirondelle"/>
<img src="images/guide_hirondelle_active.png" alt="Hirondelle"/>
</xsl:when>
<xsl:when test="$var_Text = '**'">
<img src="images/guide_hirondelle_active.png" alt="Hirondelle"/>
<img src="images/guide_hirondelle_inactive.png" alt="non"/>
</xsl:when>
<xsl:otherwise>
<img src="images/guide_hirondelle_inactive.png" alt="non"/>
<img src="images/guide_hirondelle_inactive.png" alt="non"/>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<xsl:template match="html:div[@class='guide_installation']" mode="_Copy">
<xsl:variable name="var_Text" select="string(.)"/>
<div class="guide_installation">
<span>Installation&#x00A0;:</span>
<img src="images/guide_marguerite_active.png" alt="Marguerite"/>
<xsl:choose>
<xsl:when test="$var_Text = '***'">
<img src="images/guide_marguerite_active.png" alt="Marguerite"/>
<img src="images/guide_marguerite_active.png" alt="Marguerite"/>
</xsl:when>
<xsl:when test="$var_Text = '**'">
<img src="images/guide_marguerite_active.png" alt="Marguerite"/>
<img src="images/guide_marguerite_inactive.png" alt="non"/>
</xsl:when>
<xsl:otherwise>
<img src="images/guide_marguerite_inactive.png" alt="non"/>
<img src="images/guide_marguerite_inactive.png" alt="non"/>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<xsl:template match="html:span[@class='guide_footnote']" mode="_Copy">
<span class="guide_footnote">(<xsl:apply-templates select="node()" mode="_CopyFootnote"/>)</span>
</xsl:template>
<xsl:template match="node()" mode="_CopyFootnote">
<xsl:apply-templates select="." mode="_Copy"/>
</xsl:template>
<xsl:template match="html:span[@class='guide_footnote-nr']" mode="_CopyFootnote">
</xsl:template>
</xsl:stylesheet>