blob: 9275a2506ca203dda5e6574c2dee9709e966f5d3 (
plain)
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
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="entities">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="entity">
<xsl:variable name="name" select="name"/>
<xsl:variable name="desc">
<xsl:choose>
<xsl:when test="comment = ''">
WHO AM I? WHAT AM I? I CAN'T REMEMBER!
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="comment"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="extra">
<xsl:choose>
<xsl:when test="@kind = 'system'">
<xsl:text> SYSTEM</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text></xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="body">
<xsl:apply-templates/>
</xsl:variable>
<xsl:value-of select="concat( '<!ENTITY ', @name, ' ', normalize-space($extra), ' "', normalize-space($body), '" > <!-- ', normalize-space($desc), ' -->')" disable-output-escaping="yes"/>
</xsl:template>
<xsl:template match="use">
<xsl:variable name="content" select="@entity"/>
<xsl:value-of select="normalize-space(concat( '&', $content, ';'))" disable-output-escaping="yes"/>
</xsl:template>
<xsl:template match="group">
<xsl:comment>
<xsl:value-of select="concat( ' Group: ', @name, ' ')"/>
</xsl:comment>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="comment"/>
<xsl:template match="title">
<xsl:comment>
<xsl:text> </xsl:text>
<xsl:copy-of select="."/>
<xsl:text> </xsl:text>
</xsl:comment>
</xsl:template>
</xsl:stylesheet>
|