~intellectronica/launchpad/cp-max-heat-from-context

« back to all changes in this revision

Viewing changes to doc/bazaar/html.xsl

  • Committer: Tom Berger
  • Date: 2010-03-10 15:16:02 UTC
  • mfrom: (9086.2.1 production-devel)
  • Revision ID: tom.berger@canonical.com-20100310151602-qv7y3kiys4xd5c2l
remerge production-devel

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="ISO-8859-1"?>
 
2
 
 
3
<xsl:stylesheet
 
4
    version="1.0"
 
5
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
6
    xmlns="http://www.w3.org/1999/xhtml">
 
7
 
 
8
<xsl:output method="xml" version="1.0"
 
9
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
 
10
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
 
11
 
 
12
<!-- Print an error when an element is not matched -->
 
13
 
 
14
<xsl:template match="*">
 
15
  <div class="error">Unmatched element</div>
 
16
</xsl:template>
 
17
 
 
18
 
 
19
<!-- Root templates -->
 
20
 
 
21
<xsl:template match="/TeXmacs">
 
22
  <xsl:apply-templates/>
 
23
</xsl:template>
 
24
 
 
25
<xsl:template match="/TeXmacs/*"/>
 
26
 
 
27
<xsl:template match="/TeXmacs/body">
 
28
  <html lang="en" xml:lang="en">
 
29
    <head>
 
30
      <title><xsl:value-of select="tm-par/doc-data/doc-title"/></title>
 
31
      <link  rel="stylesheet" href="texmacs.css" type="text/css"/>
 
32
    </head>
 
33
    <body>
 
34
      <xsl:apply-templates/>
 
35
    </body>
 
36
  </html>
 
37
</xsl:template>
 
38
 
 
39
 
 
40
<!-- Paragraph formating -->
 
41
 
 
42
<xsl:template match="body/tm-par">
 
43
  <p><xsl:apply-templates/></p>
 
44
</xsl:template>
 
45
 
 
46
<xsl:template match="no-page-break|no-page-break_42_"/>
 
47
 
 
48
<xsl:template match="new-page|new-page_42_"/>
 
49
 
 
50
 
 
51
<!-- Sectioning -->
 
52
 
 
53
<xsl:template match="tm-par[doc-data]|doc-data">
 
54
  <xsl:apply-templates/>
 
55
</xsl:template>
 
56
 
 
57
<xsl:template match="doc-title">
 
58
  <h1><xsl:apply-templates/></h1>
 
59
</xsl:template>
 
60
 
 
61
<xsl:template match="tm-par[section|subsection|subsubsection]">
 
62
  <xsl:apply-templates/>
 
63
</xsl:template>
 
64
 
 
65
<xsl:template match="section">
 
66
  <h2>
 
67
    <xsl:value-of select="count(preceding::section) + 1"/>
 
68
    <xsl:text>. </xsl:text>
 
69
    <xsl:apply-templates/>
 
70
  </h2>
 
71
</xsl:template>
 
72
 
 
73
<xsl:template match="subsection">
 
74
  <h3>
 
75
    <xsl:value-of select="count(preceding::section)"/>
 
76
    <xsl:text>.</xsl:text>
 
77
    <xsl:value-of select="count(preceding::subsection[generate-id(preceding::section[1]) = generate-id(current()/preceding::section[1])]) + 1"/>
 
78
    <xsl:text>. </xsl:text>
 
79
    <xsl:apply-templates/>
 
80
  </h3>
 
81
</xsl:template>
 
82
 
 
83
<xsl:template match="subsubsection">
 
84
  <h4>
 
85
    <xsl:value-of select="count(preceding::section)"/>
 
86
    <xsl:text>.</xsl:text>
 
87
    <xsl:value-of select="count(preceding::subsection[generate-id(preceding::section[1]) = generate-id(current()/preceding::section[1])])"/>
 
88
    <xsl:text>.</xsl:text>
 
89
    <xsl:value-of select="count(preceding::subsubsection[generate-id(preceding::subsection[1]) = generate-id(current()/preceding::subsection[1])]) + 1"/>
 
90
    <xsl:text>. </xsl:text>
 
91
    <xsl:apply-templates/>
 
92
  </h4>
 
93
</xsl:template>
 
94
 
 
95
<xsl:template match="paragraph">
 
96
  <strong><xsl:apply-templates/><xsl:text> </xsl:text></strong>
 
97
</xsl:template>
 
98
 
 
99
 
 
100
<!-- Unordered lists -->
 
101
 
 
102
<xsl:template match="tm-par[itemize]">
 
103
  <xsl:apply-templates/>
 
104
</xsl:template>
 
105
 
 
106
<xsl:template match="itemize">
 
107
  <ul><xsl:apply-templates/></ul>
 
108
</xsl:template>
 
109
 
 
110
<xsl:template match="itemize/tm-par[item]">
 
111
  <li><xsl:apply-templates/></li>
 
112
</xsl:template>
 
113
 
 
114
<xsl:template match="itemize/tm-par/item"/>
 
115
 
 
116
 
 
117
<!-- Description lists -->
 
118
 
 
119
<xsl:template match="tm-par[description-long|description-dash]">
 
120
  <xsl:apply-templates/>
 
121
</xsl:template>
 
122
 
 
123
<xsl:template match="description-long|description-dash">
 
124
  <dl><xsl:apply-templates/></dl>
 
125
</xsl:template>
 
126
 
 
127
<xsl:template match="description-long/tm-par[item_42_]">
 
128
  <xsl:call-template name="description-para"/>
 
129
</xsl:template>
 
130
 
 
131
<xsl:template match="description-dash/tm-par[item_42_]">
 
132
  <xsl:call-template name="description-para"/>
 
133
</xsl:template>
 
134
 
 
135
<xsl:template name="description-para">
 
136
  <dt><xsl:apply-templates select="item_42_/child::node()"/></dt>
 
137
  <dd><xsl:apply-templates/></dd>
 
138
</xsl:template>
 
139
 
 
140
<xsl:template match="description-long/tm-par/item_42_"/>
 
141
 
 
142
<xsl:template match="description-dash/tm-par/item_42_"/>
 
143
 
 
144
 
 
145
<!-- Figures -->
 
146
 
 
147
<xsl:template match="tm-par[big-figure]|big-figure/tm-arg">
 
148
  <xsl:apply-templates/>
 
149
</xsl:template>
 
150
 
 
151
<xsl:template match="big-figure">
 
152
  <div class="big-figure">
 
153
    <div class="figure-body">
 
154
      <xsl:apply-templates select="tm-arg[1]"/>
 
155
    </div>
 
156
    <div class="figure-caption">
 
157
      <b>
 
158
        <xsl:text>Figure </xsl:text>
 
159
        <xsl:value-of select="count(preceding::big-figure) + 1"/>
 
160
        <xsl:text>: </xsl:text>
 
161
      </b>
 
162
      <xsl:apply-templates select="tm-arg[2]"/>
 
163
    </div>
 
164
  </div>
 
165
</xsl:template>
 
166
 
 
167
<xsl:template match="postscript">
 
168
  <img>
 
169
    <xsl:attribute name="src">
 
170
      <xsl:value-of select="tm-arg[1]"/>
 
171
    </xsl:attribute>
 
172
    <xsl:attribute name="alt">
 
173
      <xsl:value-of select="tm-arg[1]"/>
 
174
    </xsl:attribute>
 
175
  </img>
 
176
</xsl:template>
 
177
 
 
178
 
 
179
<!-- Text styling -->
 
180
 
 
181
<xsl:template match="tm-par[with/tm-par]">
 
182
  <xsl:apply-templates/>
 
183
</xsl:template>
 
184
 
 
185
<xsl:template match="with[@color='dark red']">
 
186
  <span class="dark-red"><xsl:apply-templates/></span>
 
187
</xsl:template>
 
188
 
 
189
<xsl:template match="with[@color='dark red'][tm-par]">
 
190
  <p class="dark-red">
 
191
    <xsl:apply-templates select="tm-par/child::node()"/>
 
192
  </p>
 
193
</xsl:template>
 
194
 
 
195
<xsl:template match="with[@color='red']">
 
196
  <span class="red"><xsl:apply-templates/></span>
 
197
</xsl:template>
 
198
 
 
199
<xsl:template match="with[@font-shape='small-caps']">
 
200
  <span class="small-caps"><xsl:apply-templates/></span>
 
201
</xsl:template>
 
202
 
 
203
<xsl:template match="with[@font-shape='italic']">
 
204
  <i><xsl:apply-templates/></i>
 
205
</xsl:template>
 
206
 
 
207
<xsl:template match="verbatim">
 
208
  <tt><xsl:apply-templates/></tt>
 
209
</xsl:template>
 
210
 
 
211
<xsl:template match="em">
 
212
  <em><xsl:apply-templates/></em>
 
213
</xsl:template>
 
214
 
 
215
<!-- Hyperlinks -->
 
216
 
 
217
<xsl:template match="hlink">
 
218
  <a>
 
219
    <xsl:attribute name="href">
 
220
    <xsl:value-of select="tm-arg[2]"/>
 
221
    </xsl:attribute>
 
222
    <xsl:apply-templates select="tm-arg[1]"/>
 
223
  </a>
 
224
</xsl:template>
 
225
 
 
226
<xsl:template match="hlink/tm-arg">
 
227
  <xsl:apply-templates/>
 
228
</xsl:template>
 
229
 
 
230
</xsl:stylesheet>