]>
Commit | Line | Data |
---|---|---|
bbeff196 WP |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | ||
3 | <!-- | |
4 | xml2html.xsl - transform Bison XML Report into XHTML. | |
5 | $Id$ | |
6 | ||
7 | Copyright (C) 2007 Free Software Foundation, Inc. | |
8 | ||
9 | This file is part of Bison, the GNU Compiler Compiler. | |
10 | ||
11 | This program is free software: you can redistribute it and/or modify | |
12 | it under the terms of the GNU General Public License as published by | |
13 | the Free Software Foundation, either version 3 of the License, or | |
14 | (at your option) any later version. | |
15 | ||
16 | This program is distributed in the hope that it will be useful, | |
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | GNU General Public License for more details. | |
20 | ||
21 | You should have received a copy of the GNU General Public License | |
22 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | Written by Wojciech Polak <polak@gnu.org>. | |
25 | --> | |
26 | ||
27 | <xsl:stylesheet version="1.0" | |
28 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
29 | xmlns="http://www.w3.org/1999/xhtml"> | |
30 | ||
31 | <xsl:output method="xml" encoding="UTF-8" | |
32 | doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" | |
33 | doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" | |
34 | indent="yes"/> | |
35 | ||
36 | <xsl:template match="/"> | |
37 | <html> | |
38 | <head> | |
39 | <title>GNU Bison XML Automaton Report</title> | |
40 | <style type="text/css"><![CDATA[ | |
41 | body { | |
42 | font-family: "Nimbus Sans L", Arial, sans-serif; | |
43 | font-size: 9pt; | |
44 | } | |
45 | a:link { | |
46 | color: #1f00ff; | |
47 | text-decoration: none; | |
48 | } | |
49 | a:visited { | |
50 | color: #1f00ff; | |
51 | text-decoration: none; | |
52 | } | |
53 | a:hover { | |
54 | color: red; | |
55 | } | |
56 | #menu a { | |
57 | text-decoration: underline; | |
58 | } | |
59 | .i { | |
60 | font-style: italic; | |
61 | } | |
62 | .pre { | |
63 | font-family: monospace; | |
64 | white-space: pre; | |
65 | } | |
66 | ol.decimal { | |
67 | list-style-type: decimal; | |
68 | } | |
69 | ol.lower-alpha { | |
70 | list-style-type: lower-alpha; | |
71 | } | |
72 | .point { | |
73 | color: #cc0000; | |
74 | } | |
75 | #footer { | |
76 | margin-top: 3.5em; | |
77 | font-size: 7pt; | |
78 | } | |
79 | ]]></style> | |
80 | </head> | |
81 | <body> | |
82 | <xsl:apply-templates select="bison-xml-report"/> | |
83 | <xsl:text> </xsl:text> | |
84 | <div id="footer"><hr /> | |
85 | <a href="http://www.gnu.org/software/bison/" title="GNU Bison"> | |
86 | GNU Bison <xsl:value-of select="/bison-xml-report/@version"/></a> | |
87 | XML Automaton Report, written by | |
88 | <a href="http://www.gnu.org.ua/~polak/" title="Wojciech Polak">Wojciech Polak</a>. | |
89 | Copyright (C) 2007 Free Software Foundation, Inc.<br /> | |
90 | Verbatim copying and distribution of this entire page is permitted | |
91 | in any medium, provided this notice is preserved.</div> | |
92 | </body> | |
93 | </html> | |
94 | </xsl:template> | |
95 | ||
96 | <xsl:template match="bison-xml-report"> | |
97 | <h1>GNU Bison XML Automaton Report</h1> | |
98 | <p> | |
99 | input grammar: <span class="i"><xsl:value-of select="filename"/></span> | |
100 | </p> | |
101 | ||
102 | <xsl:text> </xsl:text> | |
103 | <h3>Table of Contents</h3> | |
104 | <ul id="menu"> | |
105 | <li> | |
106 | <a href="#reductions">Reductions</a> | |
107 | <ul class="lower-alpha"> | |
108 | <li><a href="#useless_nonterminals">Useless nonterminal symbols</a></li> | |
109 | <li><a href="#unused_terminals">Unused terminal symbols</a></li> | |
110 | <li><a href="#useless_rules">Useless rules</a></li> | |
111 | </ul> | |
112 | </li> | |
113 | <li><a href="#conflicts">Conflicts</a></li> | |
114 | <li> | |
115 | <a href="#grammar">Grammar</a> | |
116 | <ul class="lower-alpha"> | |
117 | <li><a href="#grammar">Itemset</a></li> | |
118 | <li><a href="#terminals">Terminal symbols</a></li> | |
119 | <li><a href="#nonterminals">Nonterminal symbols</a></li> | |
120 | </ul> | |
121 | </li> | |
122 | <li><a href="#automaton">Automaton</a></li> | |
123 | </ul> | |
124 | <xsl:apply-templates select="reductions"/> | |
125 | <xsl:apply-templates select="rules-never-reduced"/> | |
126 | <xsl:apply-templates select="conflicts"/> | |
127 | <xsl:apply-templates select="grammar"/> | |
128 | <xsl:apply-templates select="automaton"/> | |
129 | </xsl:template> | |
130 | ||
131 | <xsl:template match="rules-never-reduced"> | |
132 | <xsl:if test="rule"> | |
133 | <h2> | |
134 | <a name="rules_never_reduced"/> | |
135 | <xsl:text> Rules never reduced</xsl:text> | |
136 | </h2> | |
137 | <xsl:text> </xsl:text> | |
138 | <p class="pre"> | |
139 | <xsl:apply-templates select="rule"> | |
140 | <xsl:with-param name="pad" select="'3'"/> | |
141 | </xsl:apply-templates> | |
142 | </p> | |
143 | <xsl:text> </xsl:text> | |
144 | </xsl:if> | |
145 | </xsl:template> | |
146 | ||
147 | <xsl:template match="reductions"> | |
148 | <h2> | |
149 | <a name="reductions"/> | |
150 | <xsl:text> Reductions</xsl:text> | |
151 | </h2> | |
152 | <xsl:apply-templates select="useless/nonterminals"/> | |
153 | <xsl:apply-templates select="unused/terminals"/> | |
154 | <xsl:apply-templates select="useless/rules"/> | |
155 | </xsl:template> | |
156 | ||
157 | <xsl:template match="useless/nonterminals"> | |
158 | <h3> | |
159 | <a name="useless_nonterminals"/> | |
160 | <xsl:text> Useless nonterminals</xsl:text> | |
161 | </h3> | |
162 | <xsl:text> </xsl:text> | |
163 | <xsl:if test="nonterminal"> | |
164 | <p class="pre"> | |
165 | <xsl:for-each select="nonterminal"> | |
166 | <xsl:text> </xsl:text> | |
167 | <xsl:value-of select="."/> | |
168 | <xsl:text> </xsl:text> | |
169 | </xsl:for-each> | |
170 | <xsl:text> </xsl:text> | |
171 | </p> | |
172 | </xsl:if> | |
173 | </xsl:template> | |
174 | ||
175 | <xsl:template match="useless/rules"> | |
176 | <h3> | |
177 | <a name="useless_rules"/> | |
178 | <xsl:text> Useless rules</xsl:text> | |
179 | </h3> | |
180 | <xsl:text> </xsl:text> | |
181 | <xsl:if test="rule"> | |
182 | <p class="pre"> | |
183 | <xsl:apply-templates select="rule"> | |
184 | <xsl:with-param name="pad" select="'3'"/> | |
185 | </xsl:apply-templates> | |
186 | <xsl:text> </xsl:text> | |
187 | </p> | |
188 | </xsl:if> | |
189 | </xsl:template> | |
190 | ||
191 | <xsl:template match="unused/terminals"> | |
192 | <h3> | |
193 | <a name="unused_terminals"/> | |
194 | <xsl:text> Terminals which are not used</xsl:text> | |
195 | </h3> | |
196 | <xsl:text> </xsl:text> | |
197 | <xsl:if test="terminal"> | |
198 | <p class="pre"> | |
199 | <xsl:for-each select="terminal"> | |
200 | <xsl:text> </xsl:text> | |
201 | <xsl:value-of select="."/> | |
202 | <xsl:text> </xsl:text> | |
203 | </xsl:for-each> | |
204 | <xsl:text> </xsl:text> | |
205 | </p> | |
206 | </xsl:if> | |
207 | </xsl:template> | |
208 | ||
209 | <xsl:template match="conflicts"> | |
210 | <h2> | |
211 | <a name="conflicts"/> | |
212 | <xsl:text> Conflicts</xsl:text> | |
213 | </h2> | |
214 | <xsl:text> </xsl:text> | |
215 | <xsl:if test="conflict"> | |
216 | <p class="pre"> | |
217 | <xsl:apply-templates select="conflict"/> | |
218 | <xsl:text> </xsl:text> | |
219 | </p> | |
220 | </xsl:if> | |
221 | </xsl:template> | |
222 | ||
223 | <xsl:template match="conflict"> | |
224 | <a> | |
225 | <xsl:attribute name="href"> | |
226 | <xsl:value-of select="concat('#state_', @state)"/> | |
227 | </xsl:attribute> | |
228 | <xsl:value-of select="concat('State ', @state)"/> | |
229 | </a> | |
230 | <xsl:text> conflicts: </xsl:text> | |
231 | <xsl:value-of select="@num"/> | |
232 | <xsl:text> </xsl:text> | |
233 | <xsl:value-of select="@type"/> | |
234 | <xsl:text> </xsl:text> | |
235 | </xsl:template> | |
236 | ||
237 | <xsl:template match="grammar"> | |
238 | <h2> | |
239 | <a name="grammar"/> | |
240 | <xsl:text> Grammar</xsl:text> | |
241 | </h2> | |
242 | <xsl:text> </xsl:text> | |
243 | <p class="pre"> | |
244 | <xsl:apply-templates select="rules/rule"> | |
245 | <xsl:with-param name="pad" select="'3'"/> | |
246 | </xsl:apply-templates> | |
247 | </p> | |
248 | <xsl:text> </xsl:text> | |
249 | <xsl:apply-templates select="terminals"/> | |
250 | <xsl:apply-templates select="nonterminals"/> | |
251 | </xsl:template> | |
252 | ||
253 | <xsl:template match="grammar/terminals"> | |
254 | <h3> | |
255 | <a name="terminals"/> | |
256 | <xsl:text> Terminals, with rules where they appear</xsl:text> | |
257 | </h3> | |
258 | <xsl:text> </xsl:text> | |
259 | <p class="pre"> | |
260 | <xsl:apply-templates select="terminal"/> | |
261 | </p> | |
262 | <xsl:text> </xsl:text> | |
263 | </xsl:template> | |
264 | ||
265 | <xsl:template match="grammar/nonterminals"> | |
266 | <h3> | |
267 | <a name="nonterminals"/> | |
268 | <xsl:text> Nonterminals, with rules where they appear</xsl:text> | |
269 | </h3> | |
270 | <xsl:text> </xsl:text> | |
271 | <p class="pre"> | |
272 | <xsl:apply-templates select="nonterminal"/> | |
273 | </p> | |
274 | </xsl:template> | |
275 | ||
276 | <xsl:template match="terminal"> | |
277 | <b><xsl:value-of select="@symbol"/></b> | |
278 | <xsl:value-of select="concat(' (', @type, ')')"/> | |
279 | <xsl:apply-templates select="rule"/> | |
280 | <xsl:text> </xsl:text> | |
281 | </xsl:template> | |
282 | ||
283 | <xsl:template match="terminal/rule"> | |
284 | <xsl:text> </xsl:text> | |
285 | <a> | |
286 | <xsl:attribute name="href"> | |
287 | <xsl:value-of select="concat('#rule_', .)"/> | |
288 | </xsl:attribute> | |
289 | <xsl:value-of select="."/> | |
290 | </a> | |
291 | </xsl:template> | |
292 | ||
293 | <xsl:template match="nonterminal"> | |
294 | <b><xsl:value-of select="@symbol"/></b> | |
295 | <xsl:value-of select="concat(' (', @type, ')')"/> | |
296 | <xsl:text> </xsl:text> | |
297 | <xsl:if test="left/rule"> | |
298 | <xsl:text>on left:</xsl:text> | |
299 | </xsl:if> | |
300 | <xsl:apply-templates select="left/rule"/> | |
301 | <xsl:if test="left/rule and right/rule"> | |
302 | <xsl:text> </xsl:text> | |
303 | </xsl:if> | |
304 | <xsl:if test="right/rule"> | |
305 | <xsl:text>on right:</xsl:text> | |
306 | </xsl:if> | |
307 | <xsl:apply-templates select="right/rule"/> | |
308 | <xsl:text> </xsl:text> | |
309 | </xsl:template> | |
310 | ||
311 | <xsl:template match="nonterminal/left/rule|nonterminal/right/rule"> | |
312 | <xsl:text> </xsl:text> | |
313 | <a> | |
314 | <xsl:attribute name="href"> | |
315 | <xsl:value-of select="concat('#rule_', .)"/> | |
316 | </xsl:attribute> | |
317 | <xsl:value-of select="."/> | |
318 | </a> | |
319 | </xsl:template> | |
320 | ||
321 | <xsl:template match="automaton"> | |
322 | <h2> | |
323 | <a name="automaton"/> | |
324 | <xsl:text> Automaton</xsl:text> | |
325 | </h2> | |
326 | <xsl:apply-templates select="state"> | |
327 | <xsl:with-param name="pad" select="'3'"/> | |
328 | </xsl:apply-templates> | |
329 | </xsl:template> | |
330 | ||
331 | <xsl:template match="automaton/state"> | |
332 | <xsl:param name="pad"/> | |
333 | <xsl:text> </xsl:text> | |
334 | <h3> | |
335 | <a> | |
336 | <xsl:attribute name="name"> | |
337 | <xsl:value-of select="concat('state_', @number)"/> | |
338 | </xsl:attribute> | |
339 | </a> | |
340 | <xsl:text>state </xsl:text> | |
341 | <xsl:value-of select="@number"/> | |
342 | </h3> | |
343 | <xsl:text> </xsl:text> | |
344 | <p class="pre"> | |
345 | <xsl:apply-templates select="itemset/rule"> | |
346 | <xsl:with-param name="pad" select="$pad"/> | |
347 | </xsl:apply-templates> | |
348 | <xsl:apply-templates select="actions/transitions"> | |
349 | <xsl:with-param name="type" select="'shift'"/> | |
350 | </xsl:apply-templates> | |
351 | <xsl:apply-templates select="actions/errors"/> | |
352 | <xsl:apply-templates select="actions/reductions"/> | |
353 | <xsl:apply-templates select="actions/transitions"> | |
354 | <xsl:with-param name="type" select="'goto'"/> | |
355 | </xsl:apply-templates> | |
356 | <xsl:apply-templates select="solved-conflicts"/> | |
357 | </p> | |
358 | </xsl:template> | |
359 | ||
360 | <xsl:template match="actions/transitions"> | |
361 | <xsl:param name="type"/> | |
362 | <xsl:if test="transition[@type = $type]"> | |
363 | <xsl:text> </xsl:text> | |
364 | <xsl:apply-templates select="transition[@type = $type]"> | |
365 | <xsl:with-param name="pad"> | |
366 | <xsl:call-template name="max-width-symbol"> | |
367 | <xsl:with-param name="node" select="transition[@type = $type]"/> | |
368 | </xsl:call-template> | |
369 | </xsl:with-param> | |
370 | </xsl:apply-templates> | |
371 | </xsl:if> | |
372 | </xsl:template> | |
373 | ||
374 | <xsl:template match="actions/errors"> | |
375 | <xsl:if test="error"> | |
376 | <xsl:text> </xsl:text> | |
377 | <xsl:apply-templates select="error"> | |
378 | <xsl:with-param name="pad"> | |
379 | <xsl:call-template name="max-width-symbol"> | |
380 | <xsl:with-param name="node" select="error"/> | |
381 | </xsl:call-template> | |
382 | </xsl:with-param> | |
383 | </xsl:apply-templates> | |
384 | </xsl:if> | |
385 | </xsl:template> | |
386 | ||
387 | <xsl:template match="actions/reductions"> | |
388 | <xsl:if test="reduction"> | |
389 | <xsl:text> </xsl:text> | |
390 | <xsl:apply-templates select="reduction"> | |
391 | <xsl:with-param name="pad"> | |
392 | <xsl:call-template name="max-width-symbol"> | |
393 | <xsl:with-param name="node" select="reduction"/> | |
394 | </xsl:call-template> | |
395 | </xsl:with-param> | |
396 | </xsl:apply-templates> | |
397 | </xsl:if> | |
398 | </xsl:template> | |
399 | ||
400 | <xsl:template match="rule"> | |
401 | <xsl:param name="pad"/> | |
402 | <xsl:if test="not(name(..) = 'itemset') and not(preceding-sibling::rule[1]/lhs[text()] = lhs[text()])"> | |
403 | <xsl:text> </xsl:text> | |
404 | </xsl:if> | |
405 | <xsl:if test="not(name(..) = 'itemset')"> | |
406 | <a> | |
407 | <xsl:attribute name="name"> | |
408 | <xsl:value-of select="concat('rule_', @number)"/> | |
409 | </xsl:attribute> | |
410 | </a> | |
411 | </xsl:if> | |
412 | <xsl:text> </xsl:text> | |
413 | <xsl:choose> | |
414 | <xsl:when test="name(..) = 'itemset'"> | |
415 | <a> | |
416 | <xsl:attribute name="href"> | |
417 | <xsl:value-of select="concat('#rule_', @number)"/> | |
418 | </xsl:attribute> | |
419 | <xsl:call-template name="lpad"> | |
420 | <xsl:with-param name="str" select="string(@number)"/> | |
421 | <xsl:with-param name="pad" select="number($pad)"/> | |
422 | </xsl:call-template> | |
423 | </a> | |
424 | </xsl:when> | |
425 | <xsl:otherwise> | |
426 | <xsl:call-template name="lpad"> | |
427 | <xsl:with-param name="str" select="string(@number)"/> | |
428 | <xsl:with-param name="pad" select="number($pad)"/> | |
429 | </xsl:call-template> | |
430 | </xsl:otherwise> | |
431 | </xsl:choose> | |
432 | <xsl:text> </xsl:text> | |
433 | <xsl:choose> | |
434 | <xsl:when test="preceding-sibling::rule[1]/lhs[text()] = lhs[text()]"> | |
435 | <xsl:call-template name="lpad"> | |
436 | <xsl:with-param name="str" select="'|'"/> | |
437 | <xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/> | |
438 | </xsl:call-template> | |
439 | </xsl:when> | |
440 | <xsl:otherwise> | |
441 | <span class="i"> | |
442 | <xsl:value-of select="lhs"/> | |
443 | </span> | |
444 | <xsl:text> →</xsl:text> | |
445 | </xsl:otherwise> | |
446 | </xsl:choose> | |
447 | <xsl:apply-templates select="rhs/symbol|rhs/point|rhs/empty"/> | |
448 | <xsl:apply-templates select="lookaheads"/> | |
449 | <xsl:text> </xsl:text> | |
450 | </xsl:template> | |
451 | ||
452 | <xsl:template match="symbol"> | |
453 | <xsl:text> </xsl:text> | |
454 | <xsl:choose> | |
455 | <xsl:when test="@class = 'nonterminal'"> | |
456 | <span class="i"><xsl:value-of select="."/></span> | |
457 | </xsl:when> | |
458 | <xsl:otherwise> | |
459 | <b><xsl:value-of select="."/></b> | |
460 | </xsl:otherwise> | |
461 | </xsl:choose> | |
462 | </xsl:template> | |
463 | ||
464 | <xsl:template match="point"> | |
465 | <xsl:text> </xsl:text> | |
466 | <span class="point">.</span> | |
467 | </xsl:template> | |
468 | ||
469 | <xsl:template match="empty"> | |
470 | <xsl:text> ε</xsl:text> | |
471 | </xsl:template> | |
472 | ||
473 | <xsl:template match="lookaheads"> | |
474 | <xsl:text> [</xsl:text> | |
475 | <xsl:apply-templates select="symbol"/> | |
476 | <xsl:text>]</xsl:text> | |
477 | </xsl:template> | |
478 | ||
479 | <xsl:template match="lookaheads/symbol"> | |
480 | <xsl:value-of select="."/> | |
481 | <xsl:if test="position() != last()"> | |
482 | <xsl:text>, </xsl:text> | |
483 | </xsl:if> | |
484 | </xsl:template> | |
485 | ||
486 | <xsl:template match="transition"> | |
487 | <xsl:param name="pad"/> | |
488 | <xsl:text> </xsl:text> | |
489 | <xsl:call-template name="rpad"> | |
490 | <xsl:with-param name="str" select="string(@symbol)"/> | |
491 | <xsl:with-param name="pad" select="number($pad) + 2"/> | |
492 | </xsl:call-template> | |
493 | <xsl:choose> | |
494 | <xsl:when test="@type = 'shift'"> | |
495 | <a> | |
496 | <xsl:attribute name="href"> | |
497 | <xsl:value-of select="concat('#state_', @state)"/> | |
498 | </xsl:attribute> | |
499 | <xsl:value-of select="concat('shift, and go to state ', @state)"/> | |
500 | </a> | |
501 | </xsl:when> | |
502 | <xsl:when test="@type = 'goto'"> | |
503 | <a> | |
504 | <xsl:attribute name="href"> | |
505 | <xsl:value-of select="concat('#state_', @state)"/> | |
506 | </xsl:attribute> | |
507 | <xsl:value-of select="concat('go to state ', @state)"/> | |
508 | </a> | |
509 | </xsl:when> | |
510 | </xsl:choose> | |
511 | <xsl:text> </xsl:text> | |
512 | </xsl:template> | |
513 | ||
514 | <xsl:template match="error"> | |
515 | <xsl:param name="pad"/> | |
516 | <xsl:text> </xsl:text> | |
517 | <xsl:call-template name="rpad"> | |
518 | <xsl:with-param name="str" select="string(@symbol)"/> | |
519 | <xsl:with-param name="pad" select="number($pad) + 2"/> | |
520 | </xsl:call-template> | |
521 | <xsl:text>error</xsl:text> | |
522 | <xsl:text> (</xsl:text> | |
523 | <xsl:value-of select="text()"/> | |
524 | <xsl:text>)</xsl:text> | |
525 | <xsl:text> </xsl:text> | |
526 | </xsl:template> | |
527 | ||
528 | <xsl:template match="reduction"> | |
529 | <xsl:param name="pad"/> | |
530 | <xsl:text> </xsl:text> | |
531 | <xsl:call-template name="rpad"> | |
532 | <xsl:with-param name="str" select="string(@symbol)"/> | |
533 | <xsl:with-param name="pad" select="number($pad) + 2"/> | |
534 | </xsl:call-template> | |
535 | <xsl:if test="@enabled = 'false'"> | |
536 | <xsl:text>[</xsl:text> | |
537 | </xsl:if> | |
538 | <xsl:choose> | |
539 | <xsl:when test="@rule = 'accept'"> | |
540 | <xsl:text>accept</xsl:text> | |
541 | </xsl:when> | |
542 | <xsl:otherwise> | |
543 | <a> | |
544 | <xsl:attribute name="href"> | |
545 | <xsl:value-of select="concat('#rule_', @rule)"/> | |
546 | </xsl:attribute> | |
547 | <xsl:value-of select="concat('reduce using rule ', @rule)"/> | |
548 | </a> | |
549 | <xsl:text> (</xsl:text> | |
550 | <xsl:value-of | |
551 | select="/bison-xml-report/grammar/rules/rule[@number = current()/@rule]/lhs[text()]"/> | |
552 | <xsl:text>)</xsl:text> | |
553 | </xsl:otherwise> | |
554 | </xsl:choose> | |
555 | <xsl:if test="@enabled = 'false'"> | |
556 | <xsl:text>]</xsl:text> | |
557 | </xsl:if> | |
558 | <xsl:text> </xsl:text> | |
559 | </xsl:template> | |
560 | ||
561 | <xsl:template match="solved-conflicts"> | |
562 | <xsl:if test="resolution"> | |
563 | <xsl:text> </xsl:text> | |
564 | <xsl:apply-templates select="resolution"/> | |
565 | </xsl:if> | |
566 | </xsl:template> | |
567 | ||
568 | <xsl:template match="resolution"> | |
569 | <xsl:text> Conflict between </xsl:text> | |
570 | <a> | |
571 | <xsl:attribute name="href"> | |
572 | <xsl:value-of select="concat('#rule_', @rule)"/> | |
573 | </xsl:attribute> | |
574 | <xsl:value-of select="concat('rule ',@rule)"/> | |
575 | </a> | |
576 | <xsl:text> and token </xsl:text> | |
577 | <xsl:value-of select="@symbol"/> | |
578 | <xsl:text> resolved as </xsl:text> | |
579 | <xsl:if test="@type = 'error'"> | |
580 | <xsl:text>an </xsl:text> | |
581 | </xsl:if> | |
582 | <xsl:value-of select="@type"/> | |
583 | <xsl:text> (</xsl:text> | |
584 | <xsl:value-of select="."/> | |
585 | <xsl:text>). </xsl:text> | |
586 | </xsl:template> | |
587 | ||
588 | <xsl:template name="max-width-symbol"> | |
589 | <xsl:param name="node"/> | |
590 | <xsl:variable name="longest"> | |
591 | <xsl:for-each select="$node"> | |
592 | <xsl:sort data-type="number" select="string-length(@symbol)" | |
593 | order="descending"/> | |
594 | <xsl:if test="position() = 1"> | |
595 | <xsl:value-of select="string-length(@symbol)"/> | |
596 | </xsl:if> | |
597 | </xsl:for-each> | |
598 | </xsl:variable> | |
599 | <xsl:value-of select="$longest"/> | |
600 | </xsl:template> | |
601 | ||
602 | <xsl:template name="lpad"> | |
603 | <xsl:param name="str" select="''"/> | |
604 | <xsl:param name="pad" select="0"/> | |
605 | <xsl:variable name="diff" select="$pad - string-length($str)" /> | |
606 | <xsl:choose> | |
607 | <xsl:when test="$diff < 0"> | |
608 | <xsl:value-of select="$str"/> | |
609 | </xsl:when> | |
610 | <xsl:otherwise> | |
611 | <xsl:call-template name="space"> | |
612 | <xsl:with-param name="repeat" select="$diff"/> | |
613 | </xsl:call-template> | |
614 | <xsl:value-of select="$str"/> | |
615 | </xsl:otherwise> | |
616 | </xsl:choose> | |
617 | </xsl:template> | |
618 | ||
619 | <xsl:template name="rpad"> | |
620 | <xsl:param name="str" select="''"/> | |
621 | <xsl:param name="pad" select="0"/> | |
622 | <xsl:variable name="diff" select="$pad - string-length($str)"/> | |
623 | <xsl:choose> | |
624 | <xsl:when test="$diff < 0"> | |
625 | <xsl:value-of select="$str"/> | |
626 | </xsl:when> | |
627 | <xsl:otherwise> | |
628 | <xsl:value-of select="$str"/> | |
629 | <xsl:call-template name="space"> | |
630 | <xsl:with-param name="repeat" select="$diff"/> | |
631 | </xsl:call-template> | |
632 | </xsl:otherwise> | |
633 | </xsl:choose> | |
634 | </xsl:template> | |
635 | ||
636 | <xsl:template name="space"> | |
637 | <xsl:param name="repeat">0</xsl:param> | |
638 | <xsl:param name="fill" select="' '"/> | |
639 | <xsl:if test="number($repeat) >= 1"> | |
640 | <xsl:call-template name="space"> | |
641 | <xsl:with-param name="repeat" select="$repeat - 1"/> | |
642 | <xsl:with-param name="fill" select="$fill"/> | |
643 | </xsl:call-template> | |
644 | <xsl:value-of select="$fill"/> | |
645 | </xsl:if> | |
646 | </xsl:template> | |
647 | ||
648 | </xsl:stylesheet> |