comparison html.xsl @ 0:f82309a9465e

Initial commit.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 28 Jul 2011 22:57:08 +0200
parents
children b3644dff344c
comparison
equal deleted inserted replaced
-1:000000000000 0:f82309a9465e
1 <?xml version="1.0" encoding="utf-8"?>
2 <x:stylesheet version="1.0"
3 xmlns:x="http://www.w3.org/1999/XSL/Transform"
4 xmlns:o="urn:opcodes:description"
5 xmlns="http://www.w3.org/1999/xhtml">
6
7 <x:output encoding="utf-8" indent="yes" method="xml" />
8
9 <x:template match="/o:opcodes">
10 <x:processing-instruction name="xml-stylesheet">type="text/css" href="../style.css"</x:processing-instruction>
11 <html>
12 <head>
13 <title><x:value-of select="o:title"/></title>
14 </head>
15 <body>
16 <h1><x:value-of select="o:title"/></h1>
17 <x:apply-templates select="o:text"/>
18 <x:apply-templates select="o:op"/>
19 </body>
20 </html>
21 </x:template>
22
23 <x:template match="o:text">
24 <div><x:apply-templates/></div>
25 </x:template>
26
27 <x:template match="o:op">
28 <h2 id="i{o:num}">
29 <x:value-of select="o:num"/>
30 <x:if test="o:name != ''">
31 - <small><x:value-of select="o:name"/></small>
32 </x:if>
33 </h2>
34
35 <x:choose>
36 <x:when test="o:params">
37 <x:apply-templates select="o:params"/>
38 </x:when>
39 <x:otherwise>
40 <p>Takes no parameters.</p>
41 </x:otherwise>
42 </x:choose>
43
44 <p><x:apply-templates select="o:desc"/></p>
45 </x:template>
46
47 <x:template match="o:params">
48 <table>
49 <tr>
50 <th>Type</th>
51 <th>Description</th>
52 <x:if test="o:param/@values"><th>Values</th></x:if>
53 <x:if test="o:param/@min and o:param/@max"><th>Range</th></x:if>
54 </tr>
55 <x:apply-templates select="o:param"/>
56 </table>
57 </x:template>
58
59 <x:template match="o:param">
60 <tr>
61 <td><x:apply-templates select="@type"/></td>
62 <td><x:value-of select="."/></td>
63 <x:if test="@values">
64 <td><x:value-of select="@values"/></td>
65 <x:if test="../o:param/@min and ../o:param/@max"><td/></x:if>
66 </x:if>
67 <x:if test="@min and @max">
68 <x:if test="../o:param/@values"><td/></x:if>
69 <td><x:value-of select="@min"/> to <x:value-of select="@max"/></td>
70 </x:if>
71 </tr>
72 </x:template>
73
74 <x:template match="@type">
75 <x:choose>
76 <x:when test=". = 'c'">int8</x:when>
77 <x:when test=". = 's'">int16</x:when>
78 <x:when test=". = 'S'">int32</x:when>
79 <x:when test=". = 'b'">uint8</x:when>
80 <x:when test=". = 'u'">uint16</x:when>
81 <x:when test=". = 'U'">uint32</x:when>
82 <x:when test=". = 'f'">float</x:when>
83 <x:when test=". = 'd'">double</x:when>
84 <x:when test=". = 'z'">string</x:when>
85 <x:when test=". = 'm'">data</x:when>
86 <x:otherwise><x:value-of select="."/></x:otherwise>
87 </x:choose>
88 </x:template>
89
90 <x:template match="o:desc">
91 <x:choose>
92 <x:when test="o:p">
93 <x:apply-templates/>
94 </x:when>
95 <x:otherwise>
96 <p><x:apply-templates/></p>
97 </x:otherwise>
98 </x:choose>
99 </x:template>
100
101 <x:template match="o:p">
102 <p><x:apply-templates/></p>
103 </x:template>
104
105 <x:template match="o:strong">
106 <strong><x:value-of select="."/></strong>
107 </x:template>
108
109 <x:template match="o:i">
110 <i><x:value-of select="."/></i>
111 </x:template>
112
113 <x:template match="o:br">
114 <br/>
115 </x:template>
116
117 <x:template match="o:ol">
118 <ol><x:apply-templates/></ol>
119 </x:template>
120
121 <x:template match="o:li">
122 <li><x:apply-templates/></li>
123 </x:template>
124
125 <x:template match="o:stage">
126 stage <x:value-of select="."/>
127 </x:template>
128
129 <x:template match="o:ref">
130 <a href="#i{.}">instruction <x:value-of select="."/></a>
131 </x:template>
132 </x:stylesheet>