-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathkeyword2entity.xsl
53 lines (47 loc) · 1.31 KB
/
keyword2entity.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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/map">
<xsl:text disable-output-escaping="no"><!--
Keyword to entity file
--> </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<!-- Ignore these elements -->
<xsl:template match="title"/>
<xsl:template match="keydef[@type='concept']"/>
<xsl:template match="keydef">
<xsl:variable name="key">
<xsl:choose>
<xsl:when test="contains(@keys, ' ')">
<!-- FIXME -->
<xsl:value-of select="@keys"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@keys"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="content">
<xsl:variable name="tmp">
<xsl:apply-templates/>
</xsl:variable>
<xsl:text> "</xsl:text>
<xsl:value-of select="normalize-space($tmp)"/>
<xsl:text>"</xsl:text>
</xsl:variable>
<xsl:text><!ENTITY </xsl:text>
<xsl:value-of select="$key"/>
<xsl:value-of select="$content"/>
<xsl:text>> </xsl:text>
</xsl:template>
<xsl:template match="tm">
<xsl:apply-templates/>
<xsl:choose>
<xsl:when test="@tmtype='reg'">®</xsl:when>
</xsl:choose>
<xsl:text></xsl:text>
</xsl:template>
</xsl:stylesheet>