Welcome to the Toad Data Modeling Community

XSLT Reports - Part 1

Hi,

I am going to write several articles related to generation of customized outputs from Toad Data Modeler. I hope you will find them useful and informative - and maybe you will get some inspiration for making customized templates. In the series you will find out:

  • How to generate simplified XML files
  • Where to get XSD file that describes structure of simplified XML
  • How to create new XSLT file and where to put it
  • How to define default file name and default suffix for outputs
  • How to define Name and Description of your templates
  • How to create parameters that will appear in GUI
  • and finally an example of XSLT file that generates XSD from an Oracle model

At the end of this article you will find out that there is an easy way how to e.g. reverse engineer a database system and generate XSD schema for all reversed tables.

Let’s start with basic information and explanations. The current version of Toad Data Modeler allows you to generate detailed report via standard Model | Report… feature. However, there is also another possibility how to generate reports or other outputs. Click Model | Reports / XSL Transformation…. to see the other possibility. A dialog with predefined report types will open.

We can see there that using the XSL transformations we can generate HTML, CSV or XML files. What if we want to generate XSD, SVG or for example XAML code? Is it possible? - Sure! The XSL transformation allows us to work with data stored in our models without the necessity to study internal structure, scripting etc. If you are familiar with XML, xPath and XSLT, then it will be very easy for you to iterate tables, columns and other data and generate output you need to generate.

How it works: for every XSL transformation you need a source (XML file), a template (XSLT file) and a way how to do the transformation. Output type can be specified in the XSLT file.

In Toad Data Modeler, there is GUI that allows you to locate XSLT templates. But..where is the source? Where is XML? Good questions :) - On the XSL Transformation dialog, click the More button. The dialog will become twice large than it was and you will see there buttons Save XSD files as… and Show XSD File. Click the Show XSD File button. If XSD files are associated with some third party application (e.g. Visual Studio), then the file will open in the associated application. XSD file describes structure of “simplified XML”. In other words, it describes structure of our source. OK, how to generate a real XML file for testing purposes etc.? In the XSL Transformation dialog, select the Complete XML (XML) item from the first combo-box.

Then click Transform. This way you can geneate XML file. We call it “simplified XML”, because, as you probably know, all files created in Toad Data Modeler are in XML format. Save your model as *.TXP file and edit the file in notepad. You will see XML file structure. What’s the difference between simplified XML and standard TXP file? - In the amount and form of information. For example, in simplified XML you will find data types named logically, in TXP the same information is represented by GUID code. Also, simplified XML doesn’t contain information related to workspaces, generators and other data required by Toad Data Modeler application. That’s why you can get oriented in simplified XML much faster.

In next article I will explain how to create a new XSL Template and describe structure of XSL Templates used in Toad Data Modeler. Now I’d like to show you that using one relatively simple XSL template we can generate XSD for Oracle models. Download the “XML Schema (XSD) - Elements” template from the following location:
http://modeling.inside.quest.com/servlet/KbServlet/download/2574-102-4883/xsd-elements.zip

and put it to the same folder where system XSL templates are stored. Open the XSL Transformation dialog and see value in XSL File Location.

Then open any Oracle model or reverse engineer your existing Oracle database structure, click Model | Report / XSL Transformation… item and see a new item in the first combo-box. Click More, define parameters and then click Transform to generate the output and see the result.

The output can be visualized also in Visual Studio (considering column names are unique).

Regards,

Vaclav

Leave a Reply