blob: b67d4edd8d3f36b52395fce1c88fc19956601344 (
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
|
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="allprops">
<xsl:variable name="constlist">
<xsl:for-each select="document(propfile)//enumeration/value">
<xsl:sort select="@const"/>
<xsl:value-of select="@const"/>:</xsl:for-each>
</xsl:variable>
package org.apache.fop.fo.properties;
public interface Constants {
<xsl:call-template name="sortconsts">
<xsl:with-param name="consts" select="$constlist"/>
</xsl:call-template>
}
</xsl:template>
<xsl:template name="sortconsts">
<xsl:param name="consts"/>
<xsl:param name="prevconst"/>
<xsl:param name="num" select="1"/>
<xsl:variable name="cval" select="substring-before($consts,':')"/>
<xsl:choose>
<xsl:when test="$consts = ''"/>
<xsl:when test="$cval = $prevconst">
<xsl:call-template name="sortconsts">
<xsl:with-param name="consts" select="substring-after($consts,concat($cval, ':'))"/>
<xsl:with-param name="num" select="$num"/>
<xsl:with-param name="prevconst" select="$cval"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
public final static int <xsl:value-of select="$cval"/> = <xsl:value-of select="$num"/>;
<xsl:call-template name="sortconsts">
<xsl:with-param name="consts" select="substring-after($consts,concat($cval, ':'))"/>
<xsl:with-param name="num" select="$num + 1"/>
<xsl:with-param name="prevconst" select="$cval"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
|