forked from music-encoding/encoding-tools
-
Notifications
You must be signed in to change notification settings - Fork 14
/
prettyMEIsource.xsl
143 lines (127 loc) · 5.39 KB
/
prettyMEIsource.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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:mei="http://www.music-encoding.org/ns/mei" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This stylesheet sorts mei-source. -->
<xsl:template match="/">
<xsl:apply-templates mode="copy"/>
</xsl:template>
<xsl:template match="schemaSpec" mode="copy">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:text> MODULES </xsl:text>
</xsl:comment>
<xsl:apply-templates select="moduleSpec" mode="copy">
<xsl:sort select="@ident"/>
</xsl:apply-templates>
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:text> PARAMETER ENTITIES </xsl:text>
</xsl:comment>
<xsl:apply-templates select="macroSpec[@type='pe']" mode="copy">
<xsl:sort select="translate(@ident, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:apply-templates>
<!--<xsl:for-each-group select="macroSpec[@type='pe']" group-by="@module">
<xsl:sort select="translate(@module,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:value-of select="concat(' ', @module, ' ')"/>
</xsl:comment>
<xsl:apply-templates select="current-group()" mode="copy">
<xsl:sort select="translate(@ident, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:apply-templates>
</xsl:for-each-group>-->
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:text> DATATYPES </xsl:text>
</xsl:comment>
<xsl:apply-templates select="macroSpec[@type='dt']" mode="copy">
<xsl:sort select="translate(@ident, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:apply-templates>
<!--<xsl:for-each-group select="macroSpec[@type='dt']" group-by="@module">
<xsl:sort select="translate(@module,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:value-of select="concat(' ', @module, ' ')"/>
</xsl:comment>
<xsl:apply-templates select="current-group()" mode="copy">
<xsl:sort select="translate(@ident, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:apply-templates>
</xsl:for-each-group>-->
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:text> ATTRIBUTE CLASSES </xsl:text>
</xsl:comment>
<xsl:apply-templates select="classSpec[@type='atts']" mode="copy">
<xsl:sort select="translate(@ident, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:apply-templates>
<!--<xsl:for-each-group select="classSpec[@type='atts']" group-by="@module">
<xsl:sort select="translate(@module,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:value-of select="concat(' ', @module, ' ')"/>
</xsl:comment>
<xsl:apply-templates select="current-group()" mode="copy">
<xsl:sort select="translate(@ident, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:apply-templates>
</xsl:for-each-group>-->
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:text> MODEL CLASSES </xsl:text>
</xsl:comment>
<xsl:apply-templates select="classSpec[@type='model']" mode="copy">
<xsl:sort select="translate(@ident, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:apply-templates>
<!--<xsl:for-each-group select="classSpec[@type='model']" group-by="@module">
<xsl:sort select="translate(@module,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:value-of select="concat(' ', @module, ' ')"/>
</xsl:comment>
<xsl:apply-templates select="current-group()" mode="copy">
<xsl:sort select="translate(@ident, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:apply-templates>
</xsl:for-each-group>-->
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:text> ELEMENTS </xsl:text>
</xsl:comment>
<xsl:apply-templates select="elementSpec" mode="copy">
<xsl:sort select="translate(@ident, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:apply-templates>
<!--<xsl:for-each-group select="elementSpec" group-by="@module">
<xsl:sort select="translate(@module,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
<xsl:text>

</xsl:text>
<xsl:comment>
<xsl:value-of select="concat(' ', @module, ' ')"/>
</xsl:comment>
<xsl:apply-templates select="current-group()" mode="copy">
<xsl:sort select="translate(@ident, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
</xsl:apply-templates>
</xsl:for-each-group>-->
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()" mode="copy">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="copy"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>