Hi there,
after updating my Torque-schema I had to update the documentation. For
visualizing the ERD I use mogwai ERDesigner
(http://mogwai.sourceforge.net/erdesigner/erdesigner.html) which usesd
an XML-based file format. To make my life easier I wrote a little
XSL-stylesheet to transform my Torque-schema into the mogwai-format.
It transforms entities (=tables), attributes (=columns) and relations
(=foreign-keys). Only the location of the entities is missing so you
have to arrange them by yourself.
If somebody uses mogwai and Torque, the attached stylesheet may be
helpful
Cheers, Patrick
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Document : schema2erd.xsl
Created on : 7. September 2004, 13:12
Author : carlptr
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="database">
<ERDesignerModel version="0.9.2">
<Entities>
<xsl:apply-templates select="table"/>
</Entities>
<Relations>
<xsl:for-each select="table/foreign-key">
<xsl:call-template name="f-key"/>
</xsl:for-each>
</Relations>
</ERDesignerModel>
</xsl:template>
<xsl:template match="table">
<Entity>
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
<xsl:attribute name="comment"><xsl:value-of
select="@description"/></xsl:attribute>
<xsl:apply-templates/>
</Entity>
</xsl:template>
<xsl:template match="column">
<Attribute>
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
<xsl:attribute name="isrequired"><xsl:value-of
select="@required"/></xsl:attribute>
<xsl:attribute name="isprimarykey"><xsl:value-of
select="@primaryKey"/></xsl:attribute>
<xsl:attribute name="defaultvalue"><xsl:value-of
select="@default"/></xsl:attribute>
<xsl:attribute name="comment"><xsl:value-of
select="@description"/></xsl:attribute>
</Attribute>
</xsl:template>
<xsl:template name="f-key">
<Relation>
<xsl:attribute name="type">non-identifying</xsl:attribute>
<xsl:attribute name="delete-rule">DATABASE_DEFAULT</xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
<xsl:attribute name="primary"><xsl:value-of
select="@foreignTable"/></xsl:attribute>
<xsl:attribute name="secondary"><xsl:value-of
select="parent::table/@name"/></xsl:attribute>
<Mapping>
<xsl:attribute name="primary"><xsl:value-of
select="reference/@foreign"/></xsl:attribute>
<xsl:attribute name="secondary"><xsl:value-of
select="reference/@local"/></xsl:attribute>
</Mapping>
</Relation>
</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]