Skip to content
This repository was archived by the owner on Jun 16, 2021. It is now read-only.

Commit 0916fde

Browse files
committed
1 parent 8de9464 commit 0916fde

File tree

4 files changed

+583
-528
lines changed

4 files changed

+583
-528
lines changed

add-alias.xsl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2+
3+
<xsl:variable name="aliases" select="doc('aliases.xml')"/>
4+
<xsl:output encoding="US-ASCII" omit-xml-declaration="yes"/>
5+
6+
<xsl:template match="/">
7+
<xsl:processing-instruction name="xml-stylesheet">type="text/xsl" href="unicode.xsl"</xsl:processing-instruction>
8+
<xsl:text>&#10;</xsl:text>
9+
<xsl:copy-of select="comment()"/>
10+
<xsl:text>&#10;</xsl:text>
11+
<xsl:apply-templates/>
12+
<xsl:text>&#10;</xsl:text>
13+
</xsl:template>
14+
15+
<xsl:template match="processing-instruction()|comment()" priority="2"/>
16+
17+
<xsl:template match="node()|@*">
18+
<xsl:copy>
19+
<xsl:copy-of select="@*"/>
20+
<xsl:apply-templates/>
21+
</xsl:copy>
22+
</xsl:template>
23+
24+
<xsl:key name="alias" match="tr" use="concat(
25+
'U',
26+
if(string-length(td/a)=4) then '0' else '',
27+
td/a)
28+
"/>
29+
<xsl:template match="unicodedata">
30+
<xsl:copy>
31+
<xsl:copy-of select="@* except @alias"/>
32+
<xsl:if test="key('alias',../@id,$aliases)">
33+
<xsl:attribute name="alias"
34+
select="string-join(
35+
key('alias',../@id,$aliases)/td[1],';'
36+
)">
37+
</xsl:attribute>
38+
</xsl:if>
39+
</xsl:copy>
40+
</xsl:template>
41+
42+
</xsl:stylesheet>

charlist.rnc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ unicodedata = element unicodedata {
6767
attribute upper { text }?,
6868
attribute lower { text }?,
6969
attribute title { text }?,
70-
attribute mathclass { text }?
70+
attribute mathclass { text }?,
71+
attribute alias { text }?
7172
}
7273
latex = element latex { attribute set { text }?, text }
7374
varlatex = element varlatex { attribute set { text }?, text }

get-aliases

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
# add aliases from charindex.html to unicode.xml
3+
4+
rm charindex.html
5+
wget https://unicode.org/charts/charindex.html
6+
7+
echo '<table>' > aliases.xml
8+
grep 'td>[a-z0-9 \-]\+<' charindex.html >> aliases.xml
9+
echo '</table>' >> aliases.xml
10+
11+
saxon9 unicode.xml add-alias.xsl >u2.xml
12+
diff unicode.xml u2.xml

0 commit comments

Comments
 (0)