Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hdoc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Stephane Crozat
hdoc
Commits
7dc74a45
Commit
7dc74a45
authored
Jan 02, 2017
by
bperraud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refacto of ToC generation xsl code with recursive handle
parent
b50d4159
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
64 deletions
+40
-64
hdoc_to_pdf/xsl/last_transformer.xsl
hdoc_to_pdf/xsl/last_transformer.xsl
+40
-64
No files found.
hdoc_to_pdf/xsl/last_transformer.xsl
View file @
7dc74a45
...
...
@@ -21,7 +21,9 @@
<xsl:apply-templates
select=
"node()|@*"
/>
<xsl:call-template
name=
"toc"
/>
<xsl:call-template
name=
"toc"
>
<xsl:with-param
name=
"toclevel"
select=
"2"
/>
</xsl:call-template>
</body>
</xsl:template>
...
...
@@ -31,81 +33,55 @@
<!-- Gestion de la table des matières -->
<xsl:template
name=
"toc"
>
<xsl:if
test=
"count(//h2) > 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) > 0"
>
<ul
class=
"toc level3"
>
<xsl:for-each
select=
"..//h3"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
<xsl:if
test=
"count(..//h4) > 0"
>
<ul
class=
"toc level4"
>
<xsl:for-each
select=
"..//h4"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
<xsl:if
test=
"count(..//h5) > 0"
>
<ul
class=
"toc level5"
>
<xsl:for-each
select=
"..//h5"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
<xsl:if
test=
"count(..//h6) > 0"
>
<ul
class=
"toc level6"
>
<xsl:for-each
select=
"..//h6"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
<xsl:template
name=
"toc"
>
</li>
</xsl:for-each>
</ul>
<xsl:param
name=
"toclevel"
/>
<xsl:variable
name=
"hnlevel"
select=
"concat('h', $toclevel)"
/>
</xsl:if
>
<xsl:choose
>
</li
>
</xsl:for-each
>
</ul
>
<xsl:when
test=
"$toclevel = 2"
>
<xsl:if
test=
"count(//*[local-name()=$hnlevel]) > 0"
>
<h2
class=
"nocount toc-title"
>
Table des matières
</h2
>
</xsl:if>
<ul
class=
"toc level2"
>
<xsl:for-each
select=
"//*[local-name()=$hnlevel]"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
</li
>
</xsl:for-each
>
</ul
>
<xsl:call-template
name=
"toc"
>
<xsl:with-param
name=
"toclevel"
select=
"3"
/
>
</xsl:call-template
>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:when>
</li>
</xsl:for-each>
</ul>
<xsl:otherwise>
<xsl:if
test=
"count(..//*[local-name()=$hnlevel]) > 0"
>
</xsl:if>
<ul
class=
"toc level{$toclevel}"
>
<xsl:for-each
select=
"..//*[local-name()=$hnlevel]"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
</li>
</xsl:for-each>
</ul>
<xsl:if
test=
"$toclevel < 6"
>
<xsl:call-template
name=
"toc"
>
<xsl:with-param
name=
"toclevel"
select=
"$toclevel + 1"
/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:otherwise>
</xsl:if
>
</xsl:choose
>
</xsl:template>
</xsl:template>
<xsl:template
name=
"toc-a"
>
<a>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment