-
Notifications
You must be signed in to change notification settings - Fork 11
/
opdict.xsl
187 lines (169 loc) · 5.59 KB
/
opdict.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xs">
<xsl:output method="xhtml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes"><!DOCTYPE html> </xsl:text>
<html lang="en">
<head>
<title>Opt Dict</title>
<style>
body {max-width:60em;font-family:"Stix Two Math", "Cambria Math", "STIX Math", "Asana Math"}
dt {font-weight: bold}
th {text-align:left;}
</style>
<xsl:text> </xsl:text>
<script src='sorttable.js'><xsl:text> </xsl:text></script>
<xsl:text> </xsl:text>
</head>
<body>
<h1>MathML Operator Dictionary</h1>
<hr/>
<ul>
<li><a href="#compressed">Compressed View</a></li>
<li><a href="#stable">Sortable Table View</a></li>
</ul>
<hr/>
<section class="fold">
<h2 id="compressed">Compressed view</h2>
<xsl:for-each-group select="//operator-dictionary"
group-by="concat('form:',@form,' lspace:',@lspace,' rspace:',@rspace)">
<xsl:sort select="current-grouping-key()"/>
<dl>
<dt>
<xsl:value-of select="current-grouping-key()"/>
</dt>
<dd>
<dl>
<xsl:for-each-group select="current-group()" group-by="string(@priority)">
<xsl:sort select="number(@priority)"/>
<dt>Priority: <xsl:value-of select="@priority"/></dt>
<dd>
<xsl:for-each select="current-group()">
<xsl:if test="position()!=1">, </xsl:if>
<span class="mfont" title="{
replace(replace(../@id,'U0?','U+'),'-0',' U+')}{
' accent'[current()/@accent='true']}{
' stretchy'[current()/@stretchy='true']}{
' largeop'[current()/@largeop='true']}{
' symmetric'[current()/@symmetric='true']}{
' movablelimits'[current()/@movablelimits='true']}{
' '}{../lower-case(description)}">
<xsl:choose>
<!-- NFC, grrrr-->
<xsl:when test="../@id='U02ADC'">
<xsl:text>⫝̸</xsl:text>
</xsl:when>
<xsl:when test="../@id='U02329'">
<xsl:text>〈</xsl:text>
</xsl:when>
<xsl:when test="../@id='U0232A'">
<xsl:text>〉</xsl:text>
</xsl:when>
<xsl:when test="../@id=('U02061','U02062','U02063','U02064') or starts-with(../@id,'xU1E')">
<xsl:text>⟨</xsl:text>
<span style="font-size:80%;font-style:italic">
<xsl:value-of select="replace(lower-case(../description),' ',' ')"/>
</span>
<xsl:text>⟩</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:if test="starts-with(../description,'COMBINING')">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="codepoints-to-string(../tokenize(@dec,'-')!xs:int(.))"/>
</xsl:otherwise>
</xsl:choose>
</span>
</xsl:for-each>
</dd>
</xsl:for-each-group>
</dl>
</dd>
</dl>
</xsl:for-each-group>
<xsl:text> </xsl:text>
</section>
<xsl:text> </xsl:text>
<section class="fold">
<xsl:text> </xsl:text>
<h2 id="stable">Sortable Table View</h2>
<xsl:variable name="c" select="'priority','lspace','rspace'"/>
<xsl:variable name="p" select="'stretchy','accent','largeop','movablelimits', 'symmetric'"/>
<xsl:variable name="v" select="'linebreakstyle','minsize'"/>
<xsl:text> </xsl:text>
<table id="oper-dict-table" class="sortable">
<xsl:text> </xsl:text>
<thead>
<xsl:text> </xsl:text>
<tr>
<xsl:text> </xsl:text>
<xsl:for-each select="'Character','Glyph','Name','form',$c,'Properties'">
<th><xsl:value-of select="."/></th>
</xsl:for-each>
</tr>
<xsl:text> </xsl:text>
</thead>
<xsl:text> </xsl:text>
<tbody>
<xsl:text> </xsl:text>
<xsl:for-each select="/unicode/charlist/character/operator-dictionary">
<xsl:sort select="xs:integer(@priority)"/>
<xsl:text> </xsl:text>
<tr>
<xsl:variable name="od" select="."/>
<xsl:variable name="d" select="for $i in tokenize(../@dec,'-') return xs:integer($i)"/>
<xsl:text> </xsl:text>
<th>
<xsl:attribute name="abbr" select="$d[1]"/>
<xsl:choose>
<xsl:when test="empty($d[. >127])">
<xsl:value-of select="replace(replace(codepoints-to-string($d),'&','&amp;'),'<','&lt;')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="replace(../@id,'[U-]0*([0-9A-F]*)','&#x$1;')"/>
</xsl:otherwise>
</xsl:choose>
</th>
<th class="mfont">
<xsl:if test="starts-with(../description,'COMBINING')">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="
if($d=10972)
then '⫝̸'
else if($d=9001)
then '〈'
else if($d=9002) then
'〉'
else codepoints-to-string($d)"/>
</th>
<th class="uname">
<xsl:value-of select="lower-case(../description)"/></th>
<th><xsl:value-of select="@form"/></th>
<xsl:for-each select="$c">
<td><xsl:value-of select="$od/@*[name()=current()]"/></td>
</xsl:for-each>
<td>
<xsl:value-of select="
$p[$od/@*[.='true']/name()=.],
$od/@*[name()=$v]/concat(name(),'=',.)
" separator=", "/>
</td>
<xsl:text> </xsl:text>
</tr>
<xsl:text> </xsl:text>
</xsl:for-each>
</tbody>
<xsl:text> </xsl:text>
</table>
<xsl:text> </xsl:text>
</section>
<xsl:text> </xsl:text>
</body>
</html>
</xsl:template>
<xsl:key name="opdict" match="operator-dictionary" use="concat(../@id,@form)"/>
</xsl:stylesheet>