diff options
author | Karen Lease <klease@apache.org> | 2001-09-21 21:42:08 +0000 |
---|---|---|
committer | Karen Lease <klease@apache.org> | 2001-09-21 21:42:08 +0000 |
commit | 55e7cd035979a4cdd101f1b2a0c21caaa285101e (patch) | |
tree | 2bffec0b992ffedb2bf3851bb14bf22b637d47fa | |
parent | 7888b55f400430fed751bd09041a433cd3c0a415 (diff) | |
download | xmlgraphics-fop-55e7cd035979a4cdd101f1b2a0c21caaa285101e.tar.gz xmlgraphics-fop-55e7cd035979a4cdd101f1b2a0c21caaa285101e.zip |
Add support for mapping multiple keywords to the same constant in enumeration/value. Remove commented out stuff.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194476 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/codegen/properties.xsl | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/src/codegen/properties.xsl b/src/codegen/properties.xsl index 95893abd6..06c37eee7 100644 --- a/src/codegen/properties.xsl +++ b/src/codegen/properties.xsl @@ -9,7 +9,7 @@ <xsl:output method="text" /> <xsl:template match="extfile"> -<xsl:message>Do <xsl:value-of select="@href"/></xsl:message> +<!--<xsl:message>Do <xsl:value-of select="@href"/></xsl:message>--> <xsl:apply-templates select="document(@href)/*"/> </xsl:template> @@ -44,7 +44,9 @@ <xsl:template match="enumeration"> public Property checkEnumValues(String value) { <xsl:for-each select="value"> - if (value.equals("<xsl:value-of select="."/>")) { return s_prop<xsl:value-of select="@const"/>; } + <xsl:call-template name="enumvals"> + <xsl:with-param name="specvals" select="concat(.,' ')"/> + </xsl:call-template> </xsl:for-each> return super.checkEnumValues(value); } @@ -62,12 +64,6 @@ </xsl:for-each> } protected String checkValueKeywords(String keyword) { -<!-- <xsl:for-each select="../keyword-equiv"> - if (value.equals("<xsl:value-of select="@match"/>")) { - return new String("<xsl:value-of select="."/>"); - } - </xsl:for-each> ---> String value = (String)s_htKeywords.get(keyword); if (value == null) { return super.checkValueKeywords(keyword); @@ -442,17 +438,6 @@ public class <xsl:value-of select="$classname"/> extends <xsl:value-of select=" } </xsl:if> -<!-- Handle enumerated values --> -<!-- -<xsl:if test="enumeration/value"> - public Property checkEnumValues(String value) { - <xsl:for-each select="enumeration/value"> - if (value.equals("<xsl:value-of select="."/>")) { return s_prop<xsl:value-of select="@const"/>; } - </xsl:for-each> - return super.checkEnumValues(value); - } -</xsl:if> ---> <!-- Currently only works for Enum values --> <xsl:if test="derive"> @@ -535,8 +520,6 @@ public class <xsl:value-of select="$classname"/> extends <xsl:value-of select=" listprop = (ListProperty)propertyList.getExplicit("<xsl:value-of select='$shprop'/>"); if (listprop != null) { // Get a parser for the shorthand to set the individual properties -<!-- ShorthandParser shparser = new <xsl:value-of select="//property[name=$shprop]/datatype-parser"/>(listprop); ---> ShorthandParser shparser = new <xsl:value-of select="key('shorthandref', $shprop)/datatype-parser"/>(listprop); p = shparser.getValueForProperty(getPropName(), this, propertyList); } @@ -593,5 +576,18 @@ public class <xsl:value-of select="$classname"/> extends <xsl:value-of select=" <xsl:value-of select='$dt'/> </xsl:template> +<!-- If the value of an enumeration constant contains two or more words, + separated by a blank, map all of these words to the same constant. +--> +<xsl:template name="enumvals"> + <xsl:param name="specvals"/> + <xsl:if test='string-length($specvals)>0'> + <xsl:variable name="oneval" select="substring-before($specvals, ' ')"/> + if (value.equals("<xsl:value-of select="$oneval"/>")) { return s_prop<xsl:value-of select="@const"/>; } + <xsl:call-template name="enumvals"> + <xsl:with-param name="specvals" select="substring-after($specvals, ' ')"/> + </xsl:call-template> + </xsl:if> +</xsl:template> </xsl:stylesheet> |