More work on the framework - now up to the point that I can auto-generate SQL with compound primary keys, and the other features required by Andrew.
This commit is contained in:
parent
d52a3d5653
commit
07b10ab336
5 changed files with 265 additions and 93 deletions
61
transforms01/base-type-include.xslt
Executable file
61
transforms01/base-type-include.xslt
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Application Description Language framework
|
||||
base-type-include.xslt
|
||||
|
||||
(c) 2007 Cygnet Solutions Ltd
|
||||
|
||||
An xsl transform intended to be included into other XSL stylesheets,
|
||||
intended to keep lookup of the ADL base type from ADL properties in
|
||||
one place for ease of maintenance
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.1 $
|
||||
$Date: 2008-02-01 18:25:38 $
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns="http://cygnets.co.uk/schemas/adl-1.2"
|
||||
xmlns:adl="http://cygnets.co.uk/schemas/adl-1.2"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
exclude-result-prefixes="adl">
|
||||
|
||||
|
||||
<!-- return the base ADL type of the property which is passed as a parameter -->
|
||||
<xsl:template name="base-type">
|
||||
<xsl:param name="property"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$property/@type='defined'">
|
||||
<xsl:variable name="definition">
|
||||
<xsl:value-of select="$property/@typedef"/>
|
||||
</xsl:variable>
|
||||
<xsl:message terminate="no">
|
||||
Looking for definition of '<xsl:value-of select="$definition"/>';
|
||||
Found to be defined as type '<xsl:value-of select="/adl:application/adl:typedef[@name=$definition]/@type"/>'
|
||||
</xsl:message>
|
||||
<xsl:value-of select="/adl:application/adl:typedef[@name=$definition]/@type"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$property/@type='serial'">integer</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$property/@type"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- return the size of the type of the property which is passed as a parameter -->
|
||||
<xsl:template name="base-size">
|
||||
<xsl:param name="property"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$property/@type='defined'">
|
||||
<xsl:variable name="definition">
|
||||
<xsl:value-of select="$property/@typedef"/>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="/adl:application/adl:typedef[@name=$definition]/@size"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$property/@size"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
Loading…
Add table
Add a link
Reference in a new issue