Allow tablename prefix to be specified when generating ADL

This commit is contained in:
sb 2008-02-28 14:52:08 +00:00
parent 0cac7bfba9
commit 9ecbfb2f91

View file

@ -20,8 +20,8 @@
explicitly state the permission, even if it is 'none'.
$Author: sb $
$Revision: 1.7 $
$Date: 2008-02-20 12:09:53 $
$Revision: 1.8 $
$Date: 2008-02-28 14:52:08 $
-->
<xsl:stylesheet version="1.0"
@ -41,6 +41,9 @@
-->
<xsl:param name="abstract-key-name-convention" select="Id"/>
<!-- a prefix to prepend to all tablenames -->
<xsl:param name="tablename-prefix"/>
<xsl:template match="adl:application">
<xsl:copy>
<xsl:attribute name="name">
@ -61,7 +64,7 @@
* THIS FILE IS AUTOMATICALLY GENERATED AND SHOULD NOT
* BE MANUALLY EDITED.
*
* Generated using adl2canonical.xslt <xsl:value-of select="substring('$Revision: 1.7 $', 12)"/>
* Generated using adl2canonical.xslt <xsl:value-of select="substring('$Revision: 1.8 $', 12)"/>
*
***************************************************************************
</xsl:comment>
@ -71,6 +74,11 @@
<!-- an entity which already has a key tag - just copy it through -->
<xsl:template match="adl:entity[adl:key]">
<xsl:if test="not( @table)">
<xsl:attribute name="table">
<xsl:value-of select="concat( $tablename-prefix, @name)"/>
</xsl:attribute>
</xsl:if>
<xsl:comment>
entity <xsl:value-of select="@name"/> already has a key - not generating one
</xsl:comment>
@ -82,6 +90,11 @@
<!-- an entity which has a '@natural-key' attribute.
Since we've got the key tag, I think this should be disallowed -->
<xsl:template match="adl:entity[@natural-key]">
<xsl:if test="not( @table)">
<xsl:attribute name="table">
<xsl:value-of select="concat( $tablename-prefix, @name)"/>
</xsl:attribute>
</xsl:if>
<xsl:message terminate="no">
ADL WARNING: [In entity '<xsl:value-of select="@name"/>']: '@natural-key' is deprecated - use the 'key' sub element instead</xsl:message>
<entity>
@ -118,6 +131,11 @@
<entity>
<!-- copy attributes through -->
<xsl:apply-templates select="@*"/>
<xsl:if test="not( @table)">
<xsl:attribute name="table">
<xsl:value-of select="concat( $tablename-prefix, @name)"/>
</xsl:attribute>
</xsl:if>
<!-- children copied through in legal order, to ensure the document remains valid -->
<xsl:apply-templates select="adl:documentation"/>
<xsl:apply-templates select="adl:content"/>
@ -178,6 +196,12 @@
</entity>
</xsl:template>
<xsl:template match="@table">
<xsl:attribute name="table">
<xsl:value-of select="concat( $tablename-prefix, .)"/>
</xsl:attribute>
</xsl:template>
<!-- If properties='all', unroll them into a properties='listed' form.
We need to do this for lists, pages and forms; there's probably some clever
way of doing it all in a oner, but I don't know what that is -->