Project

Profile

Help

Bug #3927 » ss5.xsl

stylesheet - roland civet, 2018-10-01 11:29

 
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet
version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon">

<xsl:output method="html" version="5" encoding="UTF-8"/>

<xsl:template match="/">
<xsl:variable name="language_fr" select="'fr'" />
<xsl:variable name="language_en" select="'en'" />
<html>
<head></head>
<body>
<div>
<xsl:apply-templates select="items">
<xsl:with-param name="language" select="$language_fr" />
</xsl:apply-templates>
<xsl:apply-templates select="items">
<xsl:with-param name="language" select="$language_en" />
</xsl:apply-templates>
</div>
</body>
</html>
</xsl:template>

<xsl:template match="items">
<xsl:param name="language" />
<xsl:result-document href="{$language}/index.html">
<html>
<head></head>
<body>
<div>
<ul>
<xsl:apply-templates select="./item">
<xsl:with-param name="language" select="$language" />
</xsl:apply-templates>
</ul>
</div>
</body>
</html>
</xsl:result-document>
</xsl:template>

<xsl:template match="item">
<xsl:param name="language" />
<li><a href="item_{./@id}.html"><xsl:value-of select="./title[@language = $language]" /></a></li>

<xsl:result-document href="{$language}/item_{./@id}.html">
<html>
<head></head>
<body>
<div>
<ul class="nav">
<xsl:if test="position() > 1">
<li><a href="item_{../item[position() - 1]/@id}.html">prev</a></li>
</xsl:if>
<xsl:if test="position() &lt; last()">
<li><a href="item_{../item[position() + 1]/@id}.html">next</a></li>
</xsl:if>
</ul>
</div>
</body>
</html>
</xsl:result-document>
</xsl:template>

</xsl:stylesheet>
(1-1/3)