2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
4 <xsl:strip-space elements="doc chapter section"/>
5 <xsl:output method="xml" indent="yes" encoding="iso-8859-1"
6 doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"
7 doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"/>
9 <xsl:template match="doc">
10 <xsl:element name="html" namespace="http://www.w3.org/1999/xhtml">
12 <meta charset="utf-8"/>
14 <xsl:attribute name="rel">stylesheet</xsl:attribute>
15 <xsl:attribute name="type">text/css</xsl:attribute>
16 <xsl:attribute name="href"><xsl:value-of select="@style"/></xsl:attribute>
19 <xsl:if test='not(*/titlepage/title)'>
22 <xsl:value-of select="*/titlepage/title"/>
24 <style type="text/css">
33 border-style : solid ;
37 border-style : solid ;
47 padding-bottom : 1em ;
121 <xsl:apply-templates/>
123 <xsl:apply-templates select="//footnote" mode="footnotes"/>
128 <xsl:template match="titlepage">
130 <xsl:attribute name="class">titlepage</xsl:attribute>
131 <xsl:apply-templates/>
135 <xsl:template match="title">
137 <xsl:attribute name="class">titlepage</xsl:attribute>
138 <xsl:apply-templates/>
142 <xsl:template match="subtitle">
144 <xsl:attribute name="class">titlepage</xsl:attribute>
145 <xsl:apply-templates/>
149 <xsl:template match="author">
150 <xsl:apply-templates/><br/>
153 <xsl:template match="date">
154 <p><xsl:apply-templates/></p>
157 <xsl:template match="docinfo">
158 <table class="docinfo">
159 <tr><th colspan="2">Document Information</th></tr>
160 <xsl:apply-templates/>
164 <xsl:template match="infoitem">
166 <td><xsl:value-of select="@label"/></td>
167 <td><xsl:apply-templates/></td>
171 <xsl:template match="abstract">
173 <p><b>Abstract:</b></p>
175 <xsl:apply-templates/>
180 <!-- A template to create the section number for a node -->
182 <xsl:template name="section-number" mode="section-number" match="node()">
183 <xsl:number count="chapter|section" level="multiple" format="1.1 "/>
186 <!-- Create a table of contents -->
188 <xsl:template match="toc">
189 <h1>Table Of Contents</h1>
190 <xsl:for-each select="../chapter">
192 <xsl:number count="chapter"/>
193 <xsl:text> </xsl:text>
195 <xsl:attribute name="href">#CH<xsl:number count="chapter"/></xsl:attribute>
196 <xsl:value-of select="heading"/>
199 <xsl:for-each select="section">
201 <xsl:number count="chapter|section" level="multiple" format="1.1 "/>
203 <xsl:attribute name="href">#SEC<xsl:number count="chapter|section" level="multiple" format="1.1"/></xsl:attribute>
204 <xsl:value-of select="heading"/>
212 <!-- Chapter and section headings are all automatically numbered -->
214 <xsl:template match="chapter/heading">
216 <xsl:number count="chapter"/>
217 <xsl:text> </xsl:text>
219 <xsl:attribute name="id">CH<xsl:number count="chapter"/></xsl:attribute>
221 <xsl:apply-templates/>
225 <xsl:template match="section/heading">
227 <xsl:number count="chapter|section" level="multiple" format="1.1 "/>
229 <xsl:attribute name="id">SEC<xsl:number count="chapter|section" level="multiple" format="1.1"/></xsl:attribute>
231 <xsl:apply-templates/>
235 <xsl:template match="subsection/heading">
237 <xsl:number count="chapter|section|subsection" level="multiple" format="1.1.1 "/>
238 <xsl:apply-templates/>
242 <xsl:template match="subsubsection/heading">
244 <xsl:number count="chapter|section|subsection|subsubsection" level="multiple"
246 <xsl:apply-templates/>
250 <xsl:template match="paragraph/heading">
252 <xsl:number count="chapter|section|subsection|subsubsection|paragraph"
254 format="1.1.1.1.1 "/>
255 <xsl:apply-templates/>
259 <xsl:template match="subparagraph/heading">
261 <xsl:number count="chapter|section|subsection|subsubsection|paragraph|subparagraph"
263 format="1.1.1.1.1.1 "/>
264 <xsl:apply-templates/>
268 <!-- Trivial elements are convreted directly -->
270 <xsl:template match="para">
272 <xsl:apply-templates/>
276 <xsl:template match="quote">
278 <xsl:apply-templates/>
282 <xsl:template match="verbatim">
284 <xsl:apply-templates/>
288 <xsl:template match="example">
289 <pre class='example'>
290 <xsl:apply-templates/>
294 <xsl:template match="itemize">
296 <xsl:apply-templates/>
300 <xsl:template match="enumerate">
302 <xsl:apply-templates/>
306 <xsl:template match="description">
308 <xsl:apply-templates/>
312 <xsl:template match="itemize/item">
314 <xsl:apply-templates/>
318 <xsl:template match="enumerate/item">
320 <xsl:apply-templates/>
324 <xsl:template match="description/item">
325 <dt><xsl:value-of select='@tag'/></dt>
327 <xsl:apply-templates/>
331 <xsl:template match="footnote">
333 <xsl:attribute name='href'>#footnote<xsl:number level='any'/></xsl:attribute>
334 <xsl:number level='any'/>
338 <xsl:template match="footnote" mode="footnotes">
340 <sup><a><xsl:attribute name='id'>footnote<xsl:number level='any'/></xsl:attribute>
341 <xsl:number level='any'/></a></sup> <xsl:apply-templates/>
345 <xsl:template match="emph">
346 <em><xsl:apply-templates/></em>
349 <xsl:template match="strong">
350 <strong><xsl:apply-templates/></strong>
353 <xsl:template match="code">
354 <code><xsl:apply-templates/></code>
357 <xsl:template match="remark">
358 <span><xsl:attribute name="class">remark</xsl:attribute><xsl:apply-templates/></span>
361 <xsl:template match="sub">
362 <sub><xsl:apply-templates/></sub>
365 <xsl:template match="sup">
366 <sup><xsl:apply-templates/></sup>
369 <xsl:template match="color">
370 <span><xsl:attribute name="class"><xsl:value-of select="@colorname"/></xsl:attribute><xsl:apply-templates/></span>
373 <xsl:template match="big">
374 <big><xsl:apply-templates/></big>
377 <xsl:template match="small">
378 <small><xsl:apply-templates/></small>
381 <xsl:template match="table">
383 <xsl:apply-templates/>
387 <xsl:template match="newline"><br/></xsl:template>
389 <xsl:template match="row">
390 <tr><xsl:apply-templates/></tr>
393 <xsl:template match="thead">
394 <tr><xsl:apply-templates/></tr>
397 <xsl:template match="thead/col">
398 <th><xsl:apply-templates/></th>
401 <xsl:template match="row/col">
402 <td><xsl:apply-templates/></td>
405 <xsl:template match="picture">
406 <img><xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute>
410 <xsl:template match="label">
411 <a><xsl:attribute name='id'>
412 <xsl:value-of select="@name"/>
416 <xsl:template match="index"></xsl:template>
418 <xsl:template match="ref">
419 <a><xsl:attribute name='href'>#<xsl:value-of select="@to"/></xsl:attribute>
420 <xsl:apply-templates/>
421 <!--<xsl:apply-templates select="id(@to)" mode="section-number"/>-->
425 <xsl:template match="page"></xsl:template>
427 <xsl:template match="reference">
429 <xsl:attribute name="href">
430 <xsl:value-of select="@href"/>
432 <xsl:apply-templates/>
436 <xsl:template match="math">
437 <xsl:element name="math" namespace="http://www.w3.org/1998/Math/MathML">
438 <xsl:copy-of select='./*'/>
442 <xsl:template match="svg">
444 <xsl:copy-of select="document(@src)"/>
446 <xsl:if test='not(@src)'>
447 <xsl:element name="svg" namespace="http://www.w3.org/2000/svg">
448 <xsl:copy-of select='./*'/>