source: trunk/adm/guides/navigation02_html.xsl @ 65

Last change on this file since 65 was 65, checked in by pinsard, 15 years ago

new User's guide production

File size: 8.2 KB
Line 
1<?xml version="1.0" encoding="iso-8859-15"?>
2<xsl:stylesheet 
3xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
4version="1.0">
5<!--
6
7MODULE
8======
9
10production of navigation
11
12TODO
13====
14
15search (see doxygen output)
16
17EVOLUTIONS
18==========
19
20$Id$
21
22- fplod 2009-04-22T14:52:55Z aedon.locean-ipsl.upmc.fr (Darwin)
23
24  * avoid multiple "current" id in the same HTML file
25
26- fplod 2009-04-22T13:29:15Z aedon.locean-ipsl.upmc.fr (Darwin)
27
28  * liste des sect1 si noeud courant = appendix
29  * liste des sect1 si noeud courant = appendx/sect1
30  * identification du appendix courant si sect1
31
32- fplod 2009-04-22T13:18:37Z aedon.locean-ipsl.upmc.fr (Darwin)
33
34  * liste des chapitres si noeud courant = appendix
35
36- fplod 2009-04-22T08:44:58Z aedon.locean-ipsl.upmc.fr (Darwin)
37
38  * identification du chapitre courant si sect1
39  * liste des sect2 si noeud courant = sect1
40  * liste des chapitres si noeud courant = sect2
41  * identification du chapitre courant si sect2
42  * identification de la sect1 courante si sect2
43
44- fplod 2009-04-21T11:09:50Z aedon.locean-ipsl.upmc.fr (Darwin)
45
46  * creation inspired by
47    http://www.alistapart.com/articles/slidingdoors
48    and
49    http://www.alistapart.com/d/slidingdoors/v1/v1.html
50-->
51
52<xsl:template name="navigation02_html">
53<xsl:param name="node" select="."/>
54
55<!--
56<xsl:message>
57titre noeud: <xsl:value-of select="($node/title)"/>
58titre courant: <xsl:value-of select="(./title)"/>
59id noeud: <xsl:value-of select="($node/@id)"/>
60id courant: <xsl:value-of select="(./@id)"/>
61type courant: <xsl:value-of select="local-name()"/>
62</xsl:message>
63-->
64
65 <xsl:element name="div">
66  <xsl:attribute name="id">header_chapter</xsl:attribute> 
67
68  <!-- ul chapters and appendices -->
69  <xsl:if test="local-name() = 'book'">
70   <xsl:element name="ul">
71    <xsl:for-each select="//chapter|//appendix"> 
72     <xsl:element name="li">
73      <xsl:element name="a">
74       <xsl:attribute name="href">
75       <xsl:value-of select="@id"/>
76       <xsl:text>.html</xsl:text>
77       </xsl:attribute>
78       <xsl:value-of select="title"/>
79      </xsl:element>
80     </xsl:element>
81    </xsl:for-each>
82   </xsl:element>
83  </xsl:if>
84
85  <xsl:if test="local-name() = 'chapter'">
86   <xsl:element name="ul">
87    <xsl:for-each select="//chapter|//appendix">
88     <xsl:element name="li">
89      <xsl:if test="$node/@id = ./@id">
90       <xsl:attribute name="id">current_chapter</xsl:attribute> 
91      </xsl:if>
92      <xsl:element name="a">
93       <xsl:attribute name="href">
94       <xsl:value-of select="@id"/>
95       <xsl:text>.html</xsl:text>
96       </xsl:attribute>
97       <xsl:value-of select="title"/>
98      </xsl:element>
99     </xsl:element>
100    </xsl:for-each> 
101   </xsl:element>
102  </xsl:if>
103  <xsl:if test="local-name() = 'appendix'">
104   <xsl:element name="ul">
105    <xsl:for-each select="//chapter|//appendix">
106     <xsl:element name="li">
107      <xsl:if test="$node/@id = ./@id">
108       <xsl:attribute name="id">current_chapter</xsl:attribute>
109      </xsl:if>
110      <xsl:element name="a">
111       <xsl:attribute name="href">
112       <xsl:value-of select="@id"/>
113       <xsl:text>.html</xsl:text>
114       </xsl:attribute>
115       <xsl:value-of select="title"/>
116      </xsl:element>
117     </xsl:element>
118    </xsl:for-each>
119   </xsl:element>
120  </xsl:if>
121
122  <xsl:if test="local-name() = 'sect1'">
123   <xsl:element name="ul">
124    <xsl:for-each select="ancestor::book/chapter|ancestor::book/appendix">
125     <xsl:element name="li">
126      <xsl:if test="$node/ancestor-or-self::chapter/@id = ./@id">
127       <xsl:attribute name="id">current_chapter</xsl:attribute>
128      </xsl:if>
129      <xsl:if test="$node/ancestor-or-self::appendix/@id = ./@id">
130       <xsl:attribute name="id">current_chapter</xsl:attribute>
131      </xsl:if>
132      <xsl:element name="a">
133       <xsl:attribute name="href">
134       <xsl:value-of select="@id"/>
135       <xsl:text>.html</xsl:text>
136       </xsl:attribute>
137       <xsl:value-of select="title"/>
138      </xsl:element>
139     </xsl:element>
140    </xsl:for-each>
141   </xsl:element>
142  </xsl:if>
143  <xsl:if test="local-name() = 'sect2'">
144   <xsl:element name="ul">
145    <xsl:for-each select="ancestor::book/chapter|ancestor::book/appendix">
146     <xsl:element name="li">
147      <xsl:if test="$node/ancestor-or-self::chapter/@id = ./@id">
148       <xsl:attribute name="id">current_chapter</xsl:attribute>
149      </xsl:if>
150      <xsl:if test="$node/ancestor-or-self::appendix/@id = ./@id">
151       <xsl:attribute name="id">current_chapter</xsl:attribute>
152      </xsl:if>
153      <xsl:element name="a">
154       <xsl:attribute name="href">
155       <xsl:value-of select="@id"/>
156       <xsl:text>.html</xsl:text>
157       </xsl:attribute>
158       <xsl:value-of select="title"/>
159      </xsl:element>
160     </xsl:element>
161    </xsl:for-each>
162   </xsl:element>
163  </xsl:if>
164
165
166 </xsl:element>
167
168 <xsl:element name="div">
169  <xsl:attribute name="id">header_sect1</xsl:attribute> 
170  <xsl:if test="local-name() = 'chapter'">
171   <xsl:element name="ul"> 
172    <xsl:for-each select="./sect1">
173     <xsl:element name="li">
174      <xsl:if test="$node/@id = ./@id">
175       <xsl:attribute name="id">current_sect1</xsl:attribute> 
176      </xsl:if>
177      <xsl:element name="a">
178       <xsl:attribute name="href">
179       <xsl:value-of select="@id"/>
180       <xsl:text>.html</xsl:text>
181       </xsl:attribute>
182       <xsl:value-of select="title"/>
183      </xsl:element>
184     </xsl:element>
185    </xsl:for-each>
186   </xsl:element>
187  </xsl:if>
188  <xsl:if test="local-name() = 'appendix'">
189   <xsl:element name="ul">
190    <xsl:for-each select="./sect1">
191     <xsl:element name="li">
192      <xsl:if test="$node/@id = ./@id">
193       <xsl:attribute name="id">current_sect1</xsl:attribute>
194      </xsl:if>
195      <xsl:element name="a">
196       <xsl:attribute name="href">
197       <xsl:value-of select="@id"/>
198       <xsl:text>.html</xsl:text>
199       </xsl:attribute>
200       <xsl:value-of select="title"/>
201      </xsl:element>
202     </xsl:element>
203    </xsl:for-each>
204   </xsl:element>
205  </xsl:if>
206
207  <xsl:if test="local-name() = 'sect1'">
208   <xsl:element name="ul"> 
209    <xsl:for-each select="ancestor::chapter/sect1|ancestor::appendix/sect1">
210     <xsl:element name="li">
211      <xsl:if test="$node/@id = ./@id">
212       <xsl:attribute name="id">current_sect1</xsl:attribute> 
213      </xsl:if>
214      <xsl:element name="a">
215       <xsl:attribute name="href">
216       <xsl:value-of select="@id"/>
217       <xsl:text>.html</xsl:text>
218       </xsl:attribute>
219       <xsl:value-of select="title"/>
220      </xsl:element>
221      </xsl:element>
222    </xsl:for-each>
223   </xsl:element>
224  </xsl:if>
225  <xsl:if test="local-name() = 'sect2'">
226   <xsl:element name="ul">
227    <xsl:for-each select="ancestor::chapter/sect1">
228     <xsl:element name="li">
229      <xsl:if test="$node/ancestor-or-self::sect1/@id = ./@id">
230       <xsl:attribute name="id">current_sect1</xsl:attribute>
231      </xsl:if>
232      <xsl:element name="a">
233       <xsl:attribute name="href">
234       <xsl:value-of select="@id"/>
235       <xsl:text>.html</xsl:text>
236       </xsl:attribute>
237       <xsl:value-of select="title"/>
238      </xsl:element>
239      </xsl:element>
240    </xsl:for-each>
241   </xsl:element>
242  </xsl:if>
243
244
245 </xsl:element>
246
247 <xsl:element name="div">
248  <xsl:attribute name="id">header_sect2</xsl:attribute> 
249
250  <xsl:if test="local-name() = 'sect2'">
251   <xsl:element name="ul"> 
252    <xsl:for-each select="ancestor::sect1/sect2">
253     <xsl:element name="li">
254      <xsl:if test="$node/@id = ./@id">
255       <xsl:attribute name="id">current_sect2</xsl:attribute> 
256      </xsl:if>
257      <xsl:element name="a">
258       <xsl:attribute name="href">
259       <xsl:value-of select="@id"/>
260       <xsl:text>.html</xsl:text>
261       </xsl:attribute>
262       <xsl:value-of select="title"/>
263      </xsl:element>
264      </xsl:element>
265    </xsl:for-each>
266   </xsl:element>
267  </xsl:if>
268  <xsl:if test="local-name() = 'sect1'">
269   <xsl:element name="ul">
270    <xsl:for-each select="./sect2">
271     <xsl:element name="li">
272      <xsl:if test="$node/ancestor-or-self::sect2/@id = ./@id">
273       <xsl:attribute name="id">current_sect2</xsl:attribute>
274      </xsl:if>
275      <xsl:element name="a">
276       <xsl:attribute name="href">
277       <xsl:value-of select="@id"/>
278       <xsl:text>.html</xsl:text>
279       </xsl:attribute>
280       <xsl:value-of select="title"/>
281      </xsl:element>
282      </xsl:element>
283    </xsl:for-each>
284   </xsl:element>
285  </xsl:if>
286
287 </xsl:element>
288</xsl:template>
289</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.