|
17 | 17 |
|
18 | 18 | <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/> |
19 | 19 |
|
20 | | -<!-- GET VALID JAVA IDENTIFIER --> |
21 | | -<xsl:template name="get-valid-java-identifier"> |
22 | | - <xsl:param name="name"/> |
23 | | - <xsl:variable name="java-keywords" |
24 | | - select="'abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while true false null record sealed non-sealed'"/> |
25 | | - <xsl:choose> |
26 | | - <xsl:when test="contains('0123456789', substring($name,1,1))"> |
27 | | - <xsl:text>_</xsl:text><xsl:value-of select="$name"/> |
28 | | - </xsl:when> |
29 | | - |
30 | | - <xsl:when test="contains(concat(' ', $java-keywords, ' '), concat(' ', $name, ' '))"> |
31 | | - <xsl:text>_</xsl:text><xsl:value-of select="$name"/> |
32 | | - </xsl:when> |
33 | | - <xsl:otherwise> |
34 | | - <xsl:value-of select="$name"/> |
35 | | - </xsl:otherwise> |
36 | | - </xsl:choose> |
37 | | -</xsl:template> |
38 | | - |
39 | 20 | <!-- MAIN, FILE GENERATION --> |
40 | 21 | <xsl:template match="/constants"> |
41 | 22 |
|
|
72 | 53 |
|
73 | 54 | <xsl:template match="int" mode="Java"> |
74 | 55 | <xsl:text>	public static final int </xsl:text> |
75 | | - <xsl:call-template name="get-valid-java-identifier"> |
76 | | - <xsl:with-param name="name" select="@name"/> |
77 | | - </xsl:call-template> |
| 56 | + <xsl:value-of select="@name"/> |
78 | 57 | <xsl:text>	 = </xsl:text> |
79 | 58 | <xsl:value-of select="."/> |
80 | 59 | <xsl:text>;</xsl:text> |
|
83 | 62 |
|
84 | 63 | <xsl:template match="float" mode="Java"> |
85 | 64 | <xsl:text>	public static final double </xsl:text> |
86 | | - <xsl:call-template name="get-valid-java-identifier"> |
87 | | - <xsl:with-param name="name" select="@name"/> |
88 | | - </xsl:call-template> |
| 65 | + <xsl:value-of select="@name"/> |
89 | 66 | <xsl:choose> |
90 | 67 | <xsl:when test="@alias!='' or @alias='true'"> |
91 | 68 | <xsl:text>;</xsl:text> |
|
107 | 84 |
|
108 | 85 | <xsl:template match="string" mode="Java"> |
109 | 86 | <xsl:text>	public static final String </xsl:text> |
110 | | - <xsl:call-template name="get-valid-java-identifier"> |
111 | | - <xsl:with-param name="name" select="@name"/> |
112 | | - </xsl:call-template> |
| 87 | + <xsl:value-of select="@name"/> |
113 | 88 | <xsl:text>	 = "</xsl:text> |
114 | 89 | <xsl:value-of select="."/><xsl:text>";</xsl:text> |
115 | 90 | <xsl:value-of select="my:desc('//')"/> |
|
0 commit comments