Commit 1f1411e1 authored by bperraud's avatar bperraud

fix bugs with headers/toc

parent af314464
......@@ -55,6 +55,10 @@
<xsl:template match="h6">
<xsl:variable name="level" select="count(ancestor::section) + 2"/>
<xsl:element name="h{$level}">
<xsl:attribute name="id">
<xsl:value-of select="concat('h', $level, '-')"/>
<xsl:number level="any"/>
</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
......
......@@ -18,103 +18,93 @@
<body>
<h1><xsl:value-of select="/html/head/title"/></h1>
<p class="authors"><xsl:value-of select="/html/head/meta[@name='author']/@content"/></p>
<xsl:apply-templates select="node()|@*"/>
<xsl:call-template name="toc"/>
</body>
</xsl:template>
<!-- Cleaning des footers vides -->
<xsl:template match="footer[not(node())]"/>
<!-- Gestion de la table des matières -->
<xsl:template name="toc">
<xsl:if test="count(//h2) &gt; 0">
<h2 class="nocount toc-title">Table des matières</h2>
<ul class="toc level2">
<xsl:for-each select="//h2">
<li>
<xsl:call-template name="toc-a"/>
<xsl:if test="count(..//h3) &gt; 0">
<ul class="toc level3">
<xsl:for-each select="..//h3">
<li>
<xsl:call-template name="toc-a"/>
<xsl:if test="count(..//h4) &gt; 0">
<ul class="toc level4">
<xsl:for-each select="..//h4">
<li>
<xsl:call-template name="toc-a"/>
<xsl:if test="count(..//h5) &gt; 0">
<ul class="toc level5">
<xsl:for-each select="..//h5">
<li>
<xsl:call-template name="toc-a"/>
<xsl:if test="count(..//h6) &gt; 0">
<ul class="toc level6">
<xsl:for-each select="..//h6">
<li>
<xsl:call-template name="toc-a"/>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
<!-- <li><a href="#">Introduction</a><span>1</span></li> -->
<!-- <li class="nested"> -->
<!-- <ul class="inner"> -->
<!-- <li><a href="#">Header 1</a><span>2</span> -->
<!-- </li> -->
<!-- <li><a href="#">Header 2</a><span>2</span> -->
<!-- </li> -->
<!-- </ul> -->
<!-- </li> -->
<!-- <li><a href="#">Header 2</a><span>3</span></li> -->
</xsl:template>
<xsl:template name="toc-a">
......@@ -126,7 +116,7 @@
<xsl:value-of select="."/>
</a>
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment