+2 votes

Need some more "professional" looking document export function, which can be used to document DB schema. Easiest way would be to do a simple enough XSLT transform from ORMD XML to say HTML...

E.g.

  • TOC
  • List of Modules / Entities
  • Each Entity would show name description and properties
  • List all fields in a table with Name, Type, Description and obivious attribute values (Primary/Null/etc)
  • List all associations in a table
  • List all indexes
  • ORM specific bits can also be included, but that can be optional addon later...
in Feature Request by
edited by

Thanks for sharing your idea. We definitely add this to our todo-list and implement it in near future.

1 Answer

0 votes
Best answer

Use the following XSL file and in Ubuntu it worked like this at CLI:
xsltproc documentation.xsl v1.xml >v1.html
v1.xml was the original ORMD document, v1.html - simplistic HTML tabular view of it.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
    <h1>Database Model</h1>
    <h2>Entities</h2>

    <xsl:for-each select="orm-designer/module/entity">

    <h3><xsl:value-of select="@name"/></h3>
    <div><xsl:value-of select="@description"/></div>
    <table border="1">
      <tr>
        <th>Name</th>
        <th>Description</th>
        <th>Type</th>
        <th>Size</th>
        <th>Req</th>
        <th>PK</th>
        <th>AI</th>
      </tr>
      <xsl:for-each select="field">
        <tr>
          <td style="background: #ccc;"><xsl:value-of select="@name"/></td>
          <td><xsl:value-of select="@description"/></td>
          <td><xsl:value-of select="@type"/></td>
          <td><xsl:value-of select="@size"/></td>
          <td><xsl:value-of select="@required"/></td>
          <td><xsl:value-of select="@primary"/></td>
          <td><xsl:value-of select="@auto-increment"/></td>
        </tr>
      </xsl:for-each>
    </table>

    </xsl:for-each>
    <h2>Associations</h2>
    <table border="1">
      <tr>
        <th>From Field</th>
        <th>From Table</th>
        <th>Owner Alias</th>
        <th>To Table</th>
        <th>To Field</th>
        <th>Inverse Alias</th>
      </tr>
      <xsl:for-each select="orm-designer/module/association">
        <tr>
          <td style="background: #ccc;"><xsl:value-of select="@from"/></td>
          <td style="background: #ccc;"><xsl:value-of select="association-field/@from"/></td>
          <td style="background: #ccc;"><xsl:value-of select="@owner-alias"/></td>
          <td><xsl:value-of select="@to"/></td>
          <td><xsl:value-of select="association-field/@to"/></td>
          <td><xsl:value-of select="@inverse-alias"/></td>
        </tr>
      </xsl:for-each>
    </table>

  </body>
  </html>
</xsltemplate>
</xsl:stylesheet>
by
selected by

Can you please add similar feature to the product itself -- XSL transformations are usually very easy to achieve - both Windows and Linux provide libraries to this effect...

Hi, Welcome on our forum and thank you for sharing your XSL template.

We have short-term plan to add support for custom exporters. But instead xslt-only system we want to introduce complex export system which will support scripting (by javascript) and xslt templates similar to import/export orm feature.