diff options
author | Karen Lease <klease@apache.org> | 2000-11-10 21:51:24 +0000 |
---|---|---|
committer | Karen Lease <klease@apache.org> | 2000-11-10 21:51:24 +0000 |
commit | a02dba544228b829f47bc21b759738859a1b1532 (patch) | |
tree | d5360a1dbaeeb6520f36a66696b58a42168b363f /src/codegen/propmap.xsl | |
parent | e9dfb3e4f65e8aa8a4afd292d0c71ef637bdf946 (diff) | |
download | xmlgraphics-fop-a02dba544228b829f47bc21b759738859a1b1532.tar.gz xmlgraphics-fop-a02dba544228b829f47bc21b759738859a1b1532.zip |
New property-related XSL files
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193762 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/codegen/propmap.xsl')
-rw-r--r-- | src/codegen/propmap.xsl | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/src/codegen/propmap.xsl b/src/codegen/propmap.xsl new file mode 100644 index 000000000..bd832a9d1 --- /dev/null +++ b/src/codegen/propmap.xsl @@ -0,0 +1,114 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:lxslt="http://xml.apache.org/xslt"> + +<xsl:include href="propinc.xsl"/> + +<xsl:output method="text" /> + + +<xsl:template name="genmaker"> + <xsl:param name="prop" select="."/> + <xsl:param name="htname"/> + + <xsl:variable name="makerclass"> + <xsl:choose> + <xsl:when test="$prop/use-generic and count($prop/*)=2"> + <xsl:value-of select="$prop/use-generic"/> + </xsl:when> + <xsl:when test="$prop/class-name"> + <xsl:value-of select="$prop/class-name"/><xsl:text>Maker</xsl:text> + </xsl:when> + <xsl:otherwise> <!-- make from name --> + <xsl:call-template name="makeClassName"> + <xsl:with-param name="propstr" select="$prop/name"/> + </xsl:call-template><xsl:text>Maker</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> +<xsl:text> </xsl:text><xsl:value-of select="$htname"/>.put("<xsl:value-of select="$prop/name"/>", <xsl:value-of select="$makerclass"/>.maker("<xsl:value-of select="$prop/name"/>")); +</xsl:template> + + +<xsl:template match="text()"/> + +<xsl:template match="property-list"> +package org.apache.fop.fo.properties; + +import java.util.Hashtable; +import java.util.Enumeration; +import org.apache.fop.svg.*; + +public class <xsl:value-of select="@family"/>PropertyMapping { + + private static Hashtable s_htGeneric = new Hashtable(200); + private static Hashtable s_htElementLists = new Hashtable(10); + <xsl:for-each select="element-property-list"> + private static Hashtable s_ht<xsl:value-of select="localname[1]"/>;</xsl:for-each> + + <xsl:apply-templates/> + + public static Hashtable getGenericMappings() { + return s_htGeneric; + } + + public static Enumeration getElementMappings() { + return s_htElementLists.keys(); + } + + public static Hashtable getElementMapping(String elemName) { + return (Hashtable)s_htElementLists.get(elemName); + } +} +</xsl:template> + +<xsl:template match="generic-property-list"> + static { + // Generate the generic mapping +<xsl:apply-templates> + <xsl:with-param name="htname" select='"s_htGeneric"'/> + </xsl:apply-templates> + } +</xsl:template> + +<xsl:template match="element-property-list"> + <xsl:variable name="ename" select="localname[1]"/> + static { + s_ht<xsl:value-of select="$ename"/> = new Hashtable(); + <xsl:for-each select="localname"> + s_htElementLists.put("<xsl:value-of select='.'/>", s_ht<xsl:value-of select='$ename'/>); + </xsl:for-each> + +<xsl:apply-templates> + <xsl:with-param name='htname'>s_ht<xsl:value-of select="$ename"/></xsl:with-param> + </xsl:apply-templates> + } +</xsl:template> + +<xsl:template match="property"> + <xsl:param name="htname"/> + <xsl:variable name="refname" select="name"/> + <xsl:choose> + <xsl:when test="@type='ref'"> + <xsl:call-template name="genmaker"> + <xsl:with-param name="htname" select="$htname"/> + <xsl:with-param name="prop" + select='document(concat(@family, "properties.xml"))//property[name=$refname]'/> + </xsl:call-template> + </xsl:when> + <xsl:when test="not(@type)"> + <xsl:call-template name="genmaker"> + <xsl:with-param name="htname" select="$htname"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> +</xsl:template> + +<xsl:template match="property[@type='generic']"> + /* PROPCLASS = <xsl:call-template name="propclass"/> */ +</xsl:template> + +</xsl:stylesheet> + + |