- Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcharmap.xsl
220 lines (184 loc) · 7.41 KB
/
charmap.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?xml version="1.0"?>
<xsl:stylesheetxmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:strip-spaceelements="group"/>
<xsl:output
method="xml"indent="no"encoding="US-ASCII"omit-xml-declaration="yes"
/>
<xsl:variablename="top"> produced by the XSL script charmap.xsl
from input data in unicode.xml.
Copyright 2003 - 2013 W3C.
Use and distribution of this code are permitted under the terms of the
W3C Software Notice and License.
http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html
Please report any errors to David Carlisle
via the public W3C list www-math@w3.org.
The numeric character values assigned to each entity
(should) match the Unicode assignments in Unicode 5.2.
</xsl:variable>
<xsl:variablename="copy">
Entity names in this file are derived from files carrying the
following notice:
(C) International Organization for Standardization 19XY
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
</xsl:variable>
<xsl:templatematch="set">
<xsl:variablename="d"select="../@name"/>
<xsl:variablename="f">
<xsl:choose>
<xsl:whentest="starts-with(@name,'957')"><xsl:value-ofselect="substring(@name,11)"/></xsl:when>
<xsl:whentest="starts-with(@name,'88')"><xsl:value-ofselect="substring-after(@name,'-')"/></xsl:when>
<xsl:otherwise><xsl:value-ofselect="@name"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:text> </xsl:text>
<xsl:elementname="xsl:import">
<xsl:attributename="href"><xsl:value-ofselect="$f"/>map.xsl</xsl:attribute>
</xsl:element>
<xsl:result-documenthref="{$d}/{$f}map.xsl">
<xsl:text> </xsl:text>
<xsl:comment>
<xsl:text> File </xsl:text>
<xsl:value-ofselect="$f"/>map.xsl<xsl:text/>
<xsl:copy-ofselect="$top"/>
<xsl:choose>
<xsl:whentest="starts-with(@name,'9573') and replace(@name,'2003','1991')=../../group[@name='iso9573-1991']/set/@name">
<xsl:value-ofselect="translate($copy,'XY','86')"/>
</xsl:when>
<xsl:whentest="starts-with(@name,'9')">
<xsl:value-ofselect="translate($copy,'XY','91')"/>
</xsl:when>
<xsl:whentest="starts-with(@name,'8')">
<xsl:value-ofselect="translate($copy,'XY','86')"/>
</xsl:when>
</xsl:choose>
</xsl:comment>
<xsl:text> </xsl:text>
<xsl:elementname="xsl:stylesheet">
<xsl:attributename="version">2.0</xsl:attribute>
<xsl:text> </xsl:text>
<xsl:elementname="xsl:character-map">
<xsl:attributename="name"><xsl:value-ofselect="$f"/></xsl:attribute>
<xsl:for-eachselect="key('set',@name)">
<xsl:sortlang="en"select="@id"/>
<xsl:sortlang="en"select="not(@optional)"/>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:whentest="not(contains(../@id,'-') or ../@dec < 128)">
<xsl:elementname="xsl:output-character">
<xsl:attributename="character">
<xsl:value-ofselect="codepoints-to-string(../@dec)"/>
</xsl:attribute>
<xsl:attributename="string">
<xsl:text>&</xsl:text>
<xsl:value-ofselect="@id"/>
<xsl:text>;</xsl:text>
</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:comment>
<xsl:value-ofselect="../@id"/>
<xsl:text> </xsl:text>
<xsl:value-ofselect="@id"/>
</xsl:comment>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:element>
<xsl:text> </xsl:text>
<xsl:text> </xsl:text>
</xsl:element>
<xsl:text> </xsl:text>
</xsl:result-document>
</xsl:template>
<xsl:keyname="set"match="entity"use="@set"/>
<xsl:templatematch="/">
<xsl:apply-templatesselect="unicode/entitygroups/group[@name='2007']"/>
</xsl:template>
<xsl:templatematch="group[@name='predefined']"/>
<xsl:templatematch="group">
<xsl:result-documenthref="{@name}/entitynamesmap.xsl">
<xsl:elementname="xsl:stylesheet">
<xsl:attributename="version">2.0</xsl:attribute>
<xsl:text> </xsl:text>
<xsl:comment>
<xsl:text> entitynamesmap.xsl</xsl:text>
<xsl:copy-ofselect="$top"/>
<xsl:text> </xsl:text>
</xsl:comment>
<xsl:text> </xsl:text>
<xsl:apply-templatesselect="set"/>
<xsl:text> </xsl:text>
<xsl:elementname="xsl:character-map">
<xsl:attributename="name">
<xsl:value-ofselect="if(@name='2007') then 'w3c-entity-names' else @name"/>
</xsl:attribute>
<xsl:attributename="use-character-maps">
<xsl:for-eachselect="set">
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:whentest="starts-with(@name,'957')"><xsl:value-ofselect="substring(@name,11)"/></xsl:when>
<xsl:whentest="starts-with(@name,'88')"><xsl:value-ofselect="substring-after(@name,'-')"/></xsl:when>
<xsl:whentest="@name='html5-uppercase'"><xsl:value-ofselect="@name"/></xsl:when>
<xsl:whentest="starts-with(@name,'html')"><xsl:value-ofselect="substring-after(@name,'-')"/></xsl:when>
<xsl:otherwise><xsl:value-ofselect="@name"/></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:attribute>
</xsl:element>
<xsl:text> </xsl:text>
<xsl:text> </xsl:text>
</xsl:element>
<xsl:text> </xsl:text>
</xsl:result-document>
<xsl:result-documenthref="{@name}/htmlmathml.xsl">
<xsl:elementname="xsl:stylesheet">
<xsl:attributename="version">2.0</xsl:attribute>
<xsl:text> </xsl:text>
<xsl:comment>
<xsl:text> htmlmathml.xsl</xsl:text>
<xsl:copy-ofselect="$top"/>
<xsl:text> </xsl:text>
</xsl:comment>
<xsl:text> </xsl:text>
<xsl:for-eachselect="set[@name=../../group[@name=('mathml','html5')]/set/@name]">
<xsl:variablename="d"select="../@name"/>
<xsl:variablename="f">
<xsl:choose>
<xsl:whentest="starts-with(@name,'957')"><xsl:value-ofselect="substring(@name,11)"/></xsl:when>
<xsl:whentest="starts-with(@name,'88')"><xsl:value-ofselect="substring-after(@name,'-')"/></xsl:when>
<xsl:otherwise><xsl:value-ofselect="@name"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:text> </xsl:text>
<xsl:elementname="xsl:import">
<xsl:attributename="href"><xsl:value-ofselect="$f"/>map.xsl</xsl:attribute>
</xsl:element>
</xsl:for-each>
<xsl:text> </xsl:text>
<xsl:elementname="xsl:character-map">
<xsl:attributename="name"select="'htmlmathml'"/>
<xsl:attributename="use-character-maps">
<xsl:for-eachselect="set[@name=../../group[@name=('mathml','html5')]/set/@name]">
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:whentest="starts-with(@name,'957')"><xsl:value-ofselect="substring(@name,11)"/></xsl:when>
<xsl:whentest="starts-with(@name,'88')"><xsl:value-ofselect="substring-after(@name,'-')"/></xsl:when>
<xsl:whentest="@name='html5-uppercase'"><xsl:value-ofselect="@name"/></xsl:when>
<xsl:whentest="starts-with(@name,'html')"><xsl:value-ofselect="substring-after(@name,'-')"/></xsl:when>
<xsl:otherwise><xsl:value-ofselect="@name"/></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:attribute>
</xsl:element>
<xsl:text> </xsl:text>
<xsl:text> </xsl:text>
</xsl:element>
<xsl:text> </xsl:text>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>