2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
4 <xsl:strip-space elements="doc chapter section"/>
5 <xsl:output method="html" indent="yes" encoding="iso-8859-1"/>
7 <xsl:template match="doc">
11 <xsl:attribute name="rel">stylesheet</xsl:attribute>
12 <xsl:attribute name="type">text/css</xsl:attribute>
13 <xsl:attribute name="href"><xsl:value-of select="@style"/></xsl:attribute>
16 <xsl:value-of select="*/titlepage/title"/>
20 <xsl:apply-templates/>
22 <xsl:apply-templates select="//footnote" mode="footnotes"/>
27 <xsl:template match="titlepage">
29 <xsl:attribute name="class">titlepage</xsl:attribute>
30 <xsl:apply-templates/>
34 <xsl:template match="title">
36 <xsl:attribute name="class">titlepage</xsl:attribute>
37 <xsl:apply-templates/>
41 <xsl:template match="subtitle">
43 <xsl:attribute name="class">titlepage</xsl:attribute>
44 <xsl:apply-templates/>
48 <xsl:template match="author">
49 <xsl:apply-templates/><br/>
52 <xsl:template match="date">
53 <p><xsl:apply-templates/></p>
56 <xsl:template match="docinfo">
57 <center><table border="2" width="90%">
58 <tr><th colspan="2">Document Information</th></tr>
59 <xsl:apply-templates/>
63 <xsl:template match="infoitem">
65 <td><xsl:value-of select="@label"/></td>
66 <td><xsl:apply-templates/></td>
70 <xsl:template match="abstract">
73 <xsl:apply-templates/>
77 <!-- A template to create the section number for a node -->
79 <xsl:template name="section-number" mode="section-number" match="node()">
80 <xsl:number count="chapter|section" level="multiple" format="1.1 "/>
83 <!-- Create a table of contents -->
85 <xsl:template match="toc">
86 <h1>Table Of Contents</h1>
87 <xsl:for-each select="../chapter">
89 <xsl:number count="chapter"/>
90 <xsl:text> </xsl:text>
92 <xsl:attribute name="href">#CH<xsl:number count="chapter"/></xsl:attribute>
93 <xsl:value-of select="heading"/>
97 <xsl:for-each select="section">
99 <xsl:number count="chapter|section" level="multiple" format="1.1 "/>
101 <xsl:attribute name="href">#SEC<xsl:number count="chapter|section" level="multiple" format="1.1"/></xsl:attribute>
102 <xsl:value-of select="heading"/>
111 <!-- Chapter and section headings are all automatically numbered -->
113 <xsl:template match="chapter/heading">
115 <xsl:number count="chapter"/>
116 <xsl:text> </xsl:text>
118 <xsl:attribute name="name">CH<xsl:number count="chapter"/></xsl:attribute>
120 <xsl:apply-templates/>
124 <xsl:template match="section/heading">
126 <xsl:number count="chapter|section" level="multiple" format="1.1 "/>
128 <xsl:attribute name="name">SEC<xsl:number count="chapter|section" level="multiple" format="1.1"/></xsl:attribute>
130 <xsl:apply-templates/>
134 <xsl:template match="subsection/heading">
136 <xsl:number count="chapter|section|subsection" level="multiple" format="1.1.1 "/>
137 <xsl:apply-templates/>
141 <xsl:template match="subsubsection/heading">
143 <xsl:number count="chapter|section|subsection|subsubsection" level="multiple"
145 <xsl:apply-templates/>
149 <xsl:template match="paragraph/heading">
151 <xsl:number count="chapter|section|subsection|subsubsection|paragraph"
153 format="1.1.1.1.1 "/>
154 <xsl:apply-templates/>
158 <xsl:template match="subparagraph/heading">
160 <xsl:number count="chapter|section|subsection|subsubsection|paragraph|subparagraph"
162 format="1.1.1.1.1.1 "/>
163 <xsl:apply-templates/>
167 <!-- Trivial elements are convreted directly -->
169 <xsl:template match="para">
171 <xsl:apply-templates/>
175 <xsl:template match="quote">
177 <xsl:apply-templates/>
181 <xsl:template match="verbatim">
183 <xsl:apply-templates/>
187 <xsl:template match="itemize">
189 <xsl:apply-templates/>
193 <xsl:template match="enumerate">
195 <xsl:apply-templates/>
199 <xsl:template match="item">
201 <xsl:apply-templates/>
205 <xsl:template match="footnote">
207 <xsl:attribute name='href'>#footnote<xsl:number level='any'/></xsl:attribute>
208 <xsl:number level='any'/>
212 <xsl:template match="footnote" mode="footnotes">
213 <sup><a><xsl:attribute name='name'>footnote<xsl:number level='any'/></xsl:attribute>
214 <xsl:number level='any'/></a></sup> <xsl:apply-templates/><br/>
218 <xsl:template match="emph">
219 <em><xsl:apply-templates/></em>
222 <xsl:template match="strong">
223 <strong><xsl:apply-templates/></strong>
226 <xsl:template match="code">
227 <code><xsl:apply-templates/></code>
230 <xsl:template match="remark">
231 <span><xsl:attribute name="class">remark</xsl:attribute><xsl:apply-templates/></span>
234 <xsl:template match="sub">
235 <sub><xsl:apply-templates/></sub>
238 <xsl:template match="sup">
239 <sup><xsl:apply-templates/></sup>
242 <xsl:template match="table">
244 <xsl:apply-templates/>
248 <xsl:template match="newline"><br/></xsl:template>
250 <xsl:template match="row">
251 <tr><xsl:apply-templates/></tr>
254 <xsl:template match="thead">
255 <tr><xsl:apply-templates/></tr>
258 <xsl:template match="thead/col">
259 <th><xsl:apply-templates/></th>
262 <xsl:template match="row/col">
263 <td><xsl:apply-templates/></td>
266 <xsl:template match="picture">
267 <img><xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute>
271 <xsl:template match="label">
272 <a><xsl:attribute name='name'>
273 <xsl:value-of select="@name"/>
277 <xsl:template match="ref">
278 <a><xsl:attribute name='href'>#<xsl:value-of select="@to"/></xsl:attribute>
279 <xsl:apply-templates/>
280 <xsl:apply-templates select="id(@to)" mode="section-number"/>
284 <xsl:template match="page"></xsl:template>
286 <xsl:template match="reference">
288 <xsl:attribute name="href">
289 <xsl:value-of select="@href"/>
291 <xsl:apply-templates/>