Project

Profile

Help

How to connect?
Download (13.9 KB) Statistics
| Branch: | Revision:

he / tools / contentsDoc.xsl @ 5d25f10d

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.saxonica.com/functions"
4
    exclude-result-prefixes="xs" version="2.0">
5
    
6
    <!-- Stylesheet used to build the documentation full contents pages.
7
        Uses the reference document 'doc-ref.xml' to get correct path names, extensions, etc
8
        for different product versions, and for the static HTML and dynamic XML versions of
9
        the website. -->
10
    
11
    <xsl:import href="contents-table.xsl"/>
12

    
13
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
14

    
15
    <xsl:param name="base-uri"/>
16
    <xsl:param name="version-number"/>
17
    <xsl:param name="major-version"/>
18
    <xsl:variable name="version-ref" select="document('doc-ref.xml')/*/version[@number = $version-number]"/>    
19

    
20
    <xsl:template match="/">
21
        <xsl:call-template name="contents">
22
            <xsl:with-param name="method" select="'dynamic'"/>
23
            <xsl:with-param name="doc-homepage" as="xs:string"
24
                select="concat('../',$version-ref/@dynamic,'/index.html#!')"/>
25
            <xsl:with-param name="href" select="'contents-page.xml'"/>
26
        </xsl:call-template>
27
        <xsl:call-template name="contents">
28
            <xsl:with-param name="method" select="'static'"/>
29
            <xsl:with-param name="doc-homepage" as="xs:string" select="$version-ref/static-page/@doc-entry"/>
30
            <xsl:with-param name="href" select="'../../contents-page-static.html'"/>
31
        </xsl:call-template>
32
    </xsl:template>
33

    
34
    <xsl:template name="contents">
35
        <xsl:param name="method"/>
36
        <xsl:param name="doc-homepage"/>
37
        <xsl:param name="href"/>
38
        <xsl:result-document href="{concat($base-uri,'/',$href)}">
39
            <xsl:if test="$method='dynamic'">
40
                <xsl:processing-instruction name="xml-stylesheet">
41
                 href="../make-menu.xsl" type="text/xsl"
42
            </xsl:processing-instruction>
43
            </xsl:if>
44
            <html>
45
                <head>
46
                    <xsl:comment> Generated at <xsl:value-of select="format-dateTime(current-dateTime(), '[D] [MNn] [Y0001] at [H01]:[m01]')"/>
47
          </xsl:comment>
48
                    <this-is section="documentation" page="documentation" folder="{$version-ref/@dir}"
49
                        subpage="contents-page"/>
50
                    <title>Saxonica: Saxon <xsl:value-of select="$version-number"/> Documentation Contents</title>
51
                    <meta name="title" content="Saxonica: Saxon {$version-number} Documentation Contents"/>
52
                    <meta name="coverage" content="Worldwide"/>
53
                    <meta name="copyright" content="Copyright Saxonica Ltd"/>
54
                    <xsl:choose>
55
                        <xsl:when test="$method='static' and $version-number = $major-version">
56
                            <meta name="robots" content="index, follow"/>
57
                        </xsl:when>
58
                        <xsl:otherwise>
59
                            <meta name="robots" content="index, nofollow"/>
60
                        </xsl:otherwise>
61
                    </xsl:choose>                    
62

    
63
                </head>
64
                <body class="main">
65
                    <h1>Saxon <xsl:value-of select="$version-number"/> Documentation - Full Contents</h1>
66
                    <xsl:for-each select="contents/section">
67
                        <xsl:variable name="section" select="."/>
68
                        <xsl:if test="$method = 'dynamic'">
69
                            <p class="subhead">
70
                                <a class="toc2" href="{concat($doc-homepage, @name)}">
71
                                    <xsl:value-of select="@title"/>
72
                                </a>
73
                            </p>
74
                            <xsl:call-template name="contents-list-dynamic">
75
                                <xsl:with-param name="section" select="$section"/>
76
                                <xsl:with-param name="doc-homepage" select="$doc-homepage"/>
77
                            </xsl:call-template>                            
78
                        </xsl:if>
79
                        <xsl:if test="$method = 'static'">
80
                            <p class="subhead">
81
                                <a class="toc2" href="{concat($doc-homepage, @name, '/index.html')}">
82
                                    <xsl:value-of select="@title"/>
83
                                </a>
84
                            </p>
85
                            <xsl:call-template name="contents-list-static">
86
                                <xsl:with-param name="section" select="$section"/>
87
                                <xsl:with-param name="doc-homepage" select="$doc-homepage"/>
88
                            </xsl:call-template>
89
                        </xsl:if>
90
                    </xsl:for-each>
91
                    <div id="fixed-aside">
92
                        <xsl:call-template name="doc-contents-table">
93
                            <xsl:with-param name="method" select="$method"/>
94
                            <xsl:with-param name="version-number" select="$version-number"/>
95
                        </xsl:call-template>
96
                    </div>
97
                </body>
98
            </html>
99
        </xsl:result-document>
100
    </xsl:template>
101

    
102
    <xsl:template name="contents-list-dynamic">
103
        <xsl:param name="section"/>
104
        <xsl:param name="doc-homepage"/>
105
        <ul>
106
            <xsl:for-each select="page">
107
                <xsl:variable name="page" select="."/>
108
                <xsl:variable name="page-name">
109
                    <xsl:choose>
110
                        <xsl:when test="$section/@name = 'changes'">
111
                            <xsl:choose>
112
                                <xsl:when test="$page/@name = '7.0'">
113
                                    <xsl:value-of select="concat('6.5.5-',$page/@name)"/>
114
                                </xsl:when>
115
                                <xsl:otherwise>
116
                                    <xsl:value-of
117
                                        select="concat(following-sibling::page[1]/@name, '-',$page/@name)"
118
                                    />
119
                                </xsl:otherwise>
120
                            </xsl:choose>
121
                        </xsl:when>
122
                        <xsl:otherwise>
123
                            <xsl:value-of select="$page/@name"/>
124
                        </xsl:otherwise>
125
                    </xsl:choose>
126
                </xsl:variable>
127
                <li>
128
                    <a class="toc2" href="{concat($doc-homepage, $section/@name, '/', $page-name)}">
129
                        <xsl:value-of select="$page/@title"/>
130
                    </a>
131
                    <xsl:if test="subpage">
132
                        <ul>
133
                            <xsl:for-each select="subpage">
134
                                <xsl:variable name="subpage" select="."/>
135
                                <xsl:choose>
136
                                    <xsl:when test="$section/@name = 'changes'">
137
                                        <li>
138
                                            <a
139
                                                href="{concat($doc-homepage, $section/@name, '/', ./@name, '/', $page-name)}">
140
                                                <xsl:value-of select="@title"/>
141
                                            </a>
142
                                        </li>
143
                                    </xsl:when>
144
                                    <xsl:otherwise>
145
                                        <li>
146
                                            <a
147
                                                href="{concat($doc-homepage, $section/@name, '/', $page-name, '/', ./@name)}">
148
                                                <xsl:value-of select="@title"/>
149
                                            </a>
150
                                            <xsl:if test="subpage">
151
                                                <xsl:variable name="sub1-page"
152
                                                  select="concat($doc-homepage, $section/@name, '/', $page-name, '/', ./@name)"/>
153
                                                <ul>
154
                                                  <xsl:for-each select="subpage">
155
                                                  <xsl:variable name="sub2page" select="."/>
156
                                                  <li>
157
                                                  <a href="{concat($sub1-page, '/', ./@name)}">
158
                                                  <xsl:value-of select="@title"/>
159
                                                  </a>
160
                                                  <xsl:if test="subpage">
161
                                                  <ul>
162
                                                  <xsl:for-each select="subpage">
163
                                                  <li>
164
                                                  <a
165
                                                  href="{concat($sub1-page, '/', $sub2page/@name, '/', ./@name)}">
166
                                                  <xsl:value-of select="@title"/>
167
                                                  </a>
168

    
169
                                                  </li>
170
                                                  </xsl:for-each>
171
                                                  </ul>
172
                                                  </xsl:if>
173
                                                  </li>
174
                                                  </xsl:for-each>
175
                                                </ul>
176
                                            </xsl:if>
177
                                        </li>
178
                                    </xsl:otherwise>
179
                                </xsl:choose>
180
                            </xsl:for-each>
181
                        </ul>
182
                    </xsl:if>
183
                </li>
184
            </xsl:for-each>
185
        </ul>
186
    </xsl:template>
187

    
188
    <xsl:template name="contents-list-static">
189
        <xsl:param name="section"/>
190
        <xsl:param name="doc-homepage"/>
191
        <ul>
192
            <xsl:for-each select="page">
193
                <xsl:variable name="page" select="."/>
194
                <xsl:variable name="page-name">
195
                    <xsl:choose>
196
                        <!-- Note that the changes section is slightly different for 9.4 -->
197
                        <xsl:when test="$section/@name = 'changes' and $version-number != '9.4'">
198
                            <xsl:value-of select="concat('v',$page/@name)"/>
199
                        </xsl:when>
200
                        <xsl:otherwise>
201
                            <xsl:value-of select="$page/@name"/>
202
                        </xsl:otherwise>
203
                    </xsl:choose>
204
                </xsl:variable>
205
                <li>
206
                    <a class="toc2"
207
                        href="{concat($doc-homepage, $section/@name, '/', $page-name, fn:extension(.))}">
208
                        <xsl:value-of select="$page/@title"/>
209
                    </a>
210
                    <xsl:if test="subpage">
211
                        <ul>
212
                            <xsl:for-each select="subpage">
213
                                <xsl:variable name="subpage" select="."/>
214
                                <li>
215
                                    <a
216
                                        href="{concat($doc-homepage, $section/@name, '/', $page-name, '/', ./@name, fn:extension(.))}">
217
                                        <xsl:value-of select="@title"/>
218
                                    </a>
219
                                    <xsl:if test="subpage">
220
                                        <xsl:variable name="sub1-page"
221
                                            select="concat($doc-homepage, $section/@name, '/', $page-name, '/', ./@name)"/>
222
                                        <ul>
223
                                            <xsl:for-each select="subpage">
224
                                                <xsl:variable name="sub2page" select="."/>
225
                                                <li>
226
                                                  <a
227
                                                      href="{concat($sub1-page, '/', ./@name, fn:extension(.))}">
228
                                                  <xsl:value-of select="@title"/>
229
                                                  </a>
230
                                                  <xsl:if test="subpage">
231
                                                  <ul>
232
                                                  <xsl:for-each select="subpage">
233
                                                  <li>
234
                                                  <a
235
                                                  href="{concat($sub1-page, '/', $sub2page/@name, '/', ./@name, fn:extension(.))}">
236
                                                  <xsl:value-of select="@title"/>
237
                                                  </a>
238
                                                  </li>
239
                                                  </xsl:for-each>
240
                                                  </ul>
241
                                                  </xsl:if>
242
                                                </li>
243
                                            </xsl:for-each>
244
                                        </ul>
245
                                    </xsl:if>
246
                                </li>
247
                            </xsl:for-each>
248
                        </ul>
249
                    </xsl:if>
250
                </li>
251
            </xsl:for-each>
252
        </ul>
253
    </xsl:template>
254

    
255
    <xsl:function name="fn:extension" as="xs:string">
256
        <xsl:param name="node" as="node()"/>
257
        <xsl:choose>
258
            <xsl:when test="$node/*">
259
                <xsl:value-of select="'/index.html'"/>
260
            </xsl:when>
261
            <xsl:otherwise>
262
                <xsl:value-of select="'.html'"/>
263
            </xsl:otherwise>
264
        </xsl:choose>
265
    </xsl:function>
266

    
267
</xsl:stylesheet>
(5-5/15)