blob: 952f9e42cd579dd55f606a9e648f4a65e37896b8 (
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
|
<?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" select="comment"/>
<xsl:variable name="body">
<xsl:apply-templates/>
</xsl:variable>
<xsl:value-of select="concat( '<!ENTITY ', @name, ' "', 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>
|