Make the previous fix clozure-specific
[cxml-stp.git] / tutorial / tutorial.xsl
blobb43d3bac0e30a6b55ed41f7e6c23a5222f77e664
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
2 <xsl:output method="html"
3 indent="yes"
4 doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
5 doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
7 <xsl:template match="@*|node()">
8 <xsl:copy>
9 <xsl:apply-templates select="@*|node()"/>
10 </xsl:copy>
11 </xsl:template>
13 <xsl:template match="/">
14 <xsl:apply-templates select="/tutorial/page"/>
15 <xsl:call-template name="examples"/>
16 <html>
17 <head>
18 <title>STP Tutorial</title>
19 <link rel="stylesheet" type="text/css" href="tutorial.css"/>
20 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
21 </head>
22 <body>
23 <xsl:call-template name="header"/>
24 <div class="main">
25 <h1>Contents</h1>
26 <table cellspacing="0" cellpadding="0">
27 <xsl:for-each select="/tutorial/page">
28 <tr>
29 <td align="right">
30 <xsl:value-of select="position()"/>
31 </td>
32 <td>
33 <xsl:text>&#160;&#160;</xsl:text>
34 <a class="blue"
35 href="pages/{position()}.html">
36 <xsl:value-of select="@title"/>
37 </a>
38 <xsl:if test="@description">
39 <xsl:text>: </xsl:text>
40 <xsl:value-of select="@description"/>
41 </xsl:if>
42 </td>
43 </tr>
44 </xsl:for-each>
45 </table>
46 </div>
47 <div class="navigation">
48 start
49 <a class="icon" href="pages/1.html">
50 &#x2b17;
51 </a>
52 </div>
53 </body>
54 </html>
55 </xsl:template>
57 <xsl:template name="examples">
58 <xsl:document href="examples.html"
59 method="html"
60 indent="yes"
61 doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
62 doctype-system="http://www.w3.org/TR/html4/loose.dtd">
63 <html>
64 <head>
65 <title>
66 STP examples
67 </title>
68 <link rel="stylesheet" type="text/css" href="tutorial.css"/>
69 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
70 </head>
71 <body>
72 <div class="main" style="font-size: 8pt;">
73 <h1>STP examples</h1>
74 <p>
75 The following simple examples and code snippets have been
76 taken from the <a href="index.html">STP tutorial</a>. The
77 containing tutorial slide is linked from each example.
78 </p>
79 <xsl:for-each select="//page">
80 <xsl:variable name="i" select="position()"/>
81 <xsl:for-each select=".//example">
82 <div class="example">
83 <div class="example-header">
84 <a href="pages/{$i}.html"
85 style="color: #aaaaaa">
86 (Page <xsl:value-of select="$i"/>)&#160;
87 </a>
88 <xsl:value-of select="@title"/>
89 </div>
90 <xsl:apply-templates/>
91 </div>
92 </xsl:for-each>
93 </xsl:for-each>
94 <!--
95 <xsl:for-each select="//example">
96 <div class="example">
97 <div class="example-header">
98 <xsl:value-of select="@title"/>
99 </div>
100 <xsl:apply-templates/>
101 </div>
102 <xsl:for-each select="ancestor::page">
103 <a href="pages/{position()}.html">
104 <xsl:value-of select="position()"/>
105 </a>
106 </xsl:for-each>
107 </xsl:for-each>
109 </div>
110 </body>
111 </html>
112 </xsl:document>
113 </xsl:template>
115 <xsl:template match="page">
116 <xsl:document href="pages/{position()}.html"
117 method="html"
118 indent="yes"
119 doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
120 doctype-system="http://www.w3.org/TR/html4/loose.dtd">
121 <html>
122 <head>
123 <title>
124 Page
125 <xsl:value-of select="position()"/>
127 <xsl:value-of select="@title"/>
128 </title>
129 <link rel="stylesheet" type="text/css" href="../tutorial.css"/>
130 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
131 </head>
132 <body>
133 <xsl:call-template name="header">
134 <xsl:with-param name="base" select="'../'"/>
135 </xsl:call-template>
136 <div class="main">
137 <h1>
138 <xsl:value-of select="@title"/>
139 </h1>
140 <xsl:apply-templates/>
141 </div>
142 <div class="navigation">
143 <center>
144 <a class="icon" href="../index.html">
145 &#x2b18;
146 </a>
147 </center>
148 <xsl:choose>
149 <xsl:when test="position() > 1">
150 <a class="icon" href="{position()-1}.html">&#x2b16;</a>
151 </xsl:when>
152 <xsl:otherwise>
153 <span class="icon" style="color: #aaaaaa">&#x2b16;</span>
154 </xsl:otherwise>
155 </xsl:choose>
156 <xsl:value-of select="position()"/>
157 <xsl:text>/</xsl:text>
158 <xsl:value-of select="count(../page)"/>
159 <xsl:choose>
160 <xsl:when test="position() &lt; count(../page)">
161 <a class="icon" href="{position()+1}.html">&#x2b17;</a>
162 </xsl:when>
163 <xsl:otherwise>
164 <span class="icon" style="color: #aaaaaa">&#x2b17;</span>
165 </xsl:otherwise>
166 </xsl:choose>
167 </div>
168 </body>
169 </html>
170 </xsl:document>
171 </xsl:template>
173 <xsl:template match="code">
174 <pre class="code">
175 <xsl:apply-templates/>
176 </pre>
177 </xsl:template>
179 <xsl:template match="inline-code">
180 <tt class="inline-code">
181 <xsl:apply-templates/>
182 </tt>
183 </xsl:template>
185 <xsl:template match="repl">
186 <pre class="repl">
187 <xsl:apply-templates/>
188 </pre>
189 </xsl:template>
191 <xsl:template match="result">
192 <pre class="result">
193 <xsl:apply-templates/>
194 </pre>
195 </xsl:template>
197 <xsl:template match="spacy-list">
198 <ul class="spacy">
199 <xsl:apply-templates/>
200 </ul>
201 </xsl:template>
203 <xsl:template match="em">
204 <span class="em">
205 <xsl:apply-templates/>
206 </span>
207 </xsl:template>
209 <xsl:template name="header">
210 <xsl:param name="base"/>
211 <div id="header">
212 <table cellspacing="0" cellpadding="0" width="100%">
213 <tr>
214 <td valign="center">
215 <div style="margin-left: 30px">
216 <a href="{$base}../index.html">
218 <span>cxml&#x2013;</span>
219 <span style="color: #55a6e0">stp</span>
220 </b>
221 </a>
222 </div>
223 </td>
224 <td valign="center" align="right">
225 <b>Tutorial</b>
226 </td>
227 </tr>
228 </table>
229 </div>
230 </xsl:template>
231 </xsl:stylesheet>