comparison html.xsl @ 5:b3644dff344c

Way too much changes. :/
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 22 Aug 2011 20:30:51 +0200
parents f82309a9465e
children 79dfd9765a67
comparison
equal deleted inserted replaced
4:617e7760fd9f 5:b3644dff344c
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <x:stylesheet version="1.0" 2 <x:stylesheet version="1.0"
3 exclude-result-prefixes="o h"
3 xmlns:x="http://www.w3.org/1999/XSL/Transform" 4 xmlns:x="http://www.w3.org/1999/XSL/Transform"
4 xmlns:o="urn:opcodes:description" 5 xmlns:o="urn:opcodes:description"
6 xmlns:h="http://www.w3.org/1999/xhtml"
5 xmlns="http://www.w3.org/1999/xhtml"> 7 xmlns="http://www.w3.org/1999/xhtml">
6 8
7 <x:output encoding="utf-8" indent="yes" method="xml" /> 9 <x:output encoding="utf-8" indent="yes" method="xml" />
8 10
9 <x:template match="/o:opcodes"> 11 <x:template match="/o:opcodes">
10 <x:processing-instruction name="xml-stylesheet">type="text/css" href="../style.css"</x:processing-instruction>
11 <html> 12 <html>
12 <head> 13 <head>
13 <title><x:value-of select="o:title"/></title> 14 <title><x:value-of select="o:title"/></title>
14 </head> 15 </head>
15 <body> 16 <body>
16 <h1><x:value-of select="o:title"/></h1> 17 <h1><x:value-of select="o:title"/></h1>
17 <x:apply-templates select="o:text"/> 18
19 <x:for-each select="o:text/h:div/*">
20 <x:call-template name="xhtml"/>
21 </x:for-each>
22
18 <x:apply-templates select="o:op"/> 23 <x:apply-templates select="o:op"/>
19 </body> 24 </body>
20 </html> 25 </html>
21 </x:template> 26 </x:template>
22 27
23 <x:template match="o:text">
24 <div><x:apply-templates/></div>
25 </x:template>
26
27 <x:template match="o:op"> 28 <x:template match="o:op">
28 <h2 id="i{o:num}"> 29 <h3 id="i{o:num}">
29 <x:value-of select="o:num"/> 30 <x:value-of select="o:num"/>
30 <x:if test="o:name != ''"> 31 <x:if test="o:name != ''">
31 - <small><x:value-of select="o:name"/></small> 32 <x:text> - </x:text><small><x:value-of select="o:name"/></small>
32 </x:if> 33 </x:if>
33 </h2> 34 </h3>
34 35
35 <x:choose> 36 <x:choose>
36 <x:when test="o:params"> 37 <x:when test="o:params">
37 <x:apply-templates select="o:params"/> 38 <x:apply-templates select="o:params"/>
38 </x:when> 39 </x:when>
39 <x:otherwise> 40 <x:otherwise>
40 <p>Takes no parameters.</p> 41 <p>Takes no parameters.</p>
41 </x:otherwise> 42 </x:otherwise>
42 </x:choose> 43 </x:choose>
43 44
44 <p><x:apply-templates select="o:desc"/></p> 45 <x:apply-templates select="o:desc"/>
45 </x:template> 46 </x:template>
46 47
47 <x:template match="o:params"> 48 <x:template match="o:params">
48 <table> 49 <table>
49 <tr> 50 <tr>
50 <th>Type</th> 51 <th>Type</th>
51 <th>Description</th> 52 <x:if test="o:param/@name"><th>Name</th></x:if>
53 <x:if test="o:param/@unit"><th>Unit</th></x:if>
54 <x:if test="o:param/@var"><th>Variable</th></x:if>
55 <x:if test="o:param != ''"><th>Notes</th></x:if>
52 <x:if test="o:param/@values"><th>Values</th></x:if> 56 <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> 57 </tr>
55 <x:apply-templates select="o:param"/> 58 <x:apply-templates select="o:param"/>
56 </table> 59 </table>
57 </x:template> 60 </x:template>
58 61
59 <x:template match="o:param"> 62 <x:template match="o:param">
60 <tr> 63 <tr>
61 <td><x:apply-templates select="@type"/></td> 64 <td><x:apply-templates select="@type"/></td>
62 <td><x:value-of select="."/></td> 65 <x:if test="../o:param/@name">
63 <x:if test="@values"> 66 <td><x:value-of select="@name"/></td>
67 </x:if>
68 <x:if test="../o:param/@unit">
69 <td><x:value-of select="@unit"/></td>
70 </x:if>
71 <x:if test="../o:param/@var">
72 <td><x:value-of select="@var"/></td>
73 </x:if>
74 <x:if test="../o:param != ''">
75 <td><x:value-of select="."/></td>
76 </x:if>
77 <x:if test="../o:param/@values">
64 <td><x:value-of select="@values"/></td> 78 <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> 79 </x:if>
71 </tr> 80 </tr>
72 </x:template> 81 </x:template>
73 82
74 <x:template match="@type"> 83 <x:template match="@type">
96 <p><x:apply-templates/></p> 105 <p><x:apply-templates/></p>
97 </x:otherwise> 106 </x:otherwise>
98 </x:choose> 107 </x:choose>
99 </x:template> 108 </x:template>
100 109
110 <x:template name="xhtml" match="node() | @*">
111 <x:copy>
112 <x:apply-templates select="node() | @*" />
113 </x:copy>
114 </x:template>
115
101 <x:template match="o:p"> 116 <x:template match="o:p">
102 <p><x:apply-templates/></p> 117 <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> 118 </x:template>
112 119
113 <x:template match="o:br"> 120 <x:template match="o:br">
114 <br/> 121 <br/>
115 </x:template> 122 </x:template>
121 <x:template match="o:li"> 128 <x:template match="o:li">
122 <li><x:apply-templates/></li> 129 <li><x:apply-templates/></li>
123 </x:template> 130 </x:template>
124 131
125 <x:template match="o:stage"> 132 <x:template match="o:stage">
126 stage <x:value-of select="."/> 133 <x:text>stage </x:text><x:value-of select="."/>
127 </x:template> 134 </x:template>
128 135
129 <x:template match="o:ref"> 136 <x:template match="o:ref">
130 <a href="#i{.}">instruction <x:value-of select="."/></a> 137 <x:variable name="ref" select="."/>
138 <a href="#i{$ref}">
139 <x:choose>
140 <x:when test="/o:opcodes/o:op[o:num = $ref]/o:name = ''">
141 <x:text>instruction </x:text><x:value-of select="$ref"/>
142 </x:when>
143 <x:otherwise>
144 <x:value-of select="/o:opcodes/o:op[o:num = $ref]/o:name"/>
145 </x:otherwise>
146 </x:choose>
147 </a>
131 </x:template> 148 </x:template>
132 </x:stylesheet> 149 </x:stylesheet>