XSLT Reports - Part 2
Tuesday, February 17th, 2009Hi,
In part two of the XSLT Reports series, I will explain you how to define items that will be displayed in GUI. You will learn how to define default Description, file name, suffix and also how to define parameters and other settings.
See below a new XSL template created for one of our community members.

And this way your definitions will be displayed in Toad Data Modeler.

Let’s continue with the XSLT structure.
In the stylesheet element, you can see definition of standard XSLT namespace plus two additional namespace definitions. The first additional namespace is xmlns:tdm="http://www.quest.com/toad-data-modeler", used for TDM related items, the second additional namespace is xmlns:msxsl="urn:schemas-microsoft-com:xslt", used only when JavaScript function needs to be executed during XSL Transformation.
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tdm="http://www.quest.com/toad-data-modeler" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
The Stylesheet element is followed by several TDM related elements.
<tdm:description>Output contains Relationship name, parent entity and child entity names and parent and child attribute names. You can change ListSeparator as well as AttributeSeparator parameters. ListSeparator separates CSV values, AttributeSeparator separates attribute names (relationship created using PK of multiple columns.) </tdm:description> <tdm:caption>Relationships (CSV)</tdm:caption> <tdm:default-filename>relationships</tdm:default-filename> <tdm:default-suffix>csv</tdm:default-suffix> <tdm:db-platforms> <tdm:db-platform>all</tdm:db-platform> </tdm:db-platforms>
- tdm:description - use this element to describe your XSLT. The content will appear in GUI, see the screenshot above.
- tdm:caption - allows you to name your XSLT. Whatever you write into this element, it will appear in combo-box.
- tdm:default-filename - gives you the possibility to specify a default name for output.
- tdm:default-suffix - hmmm. It is not very hard to guess what this stands for, isn’t it?
- tdm:default-filename - gives you the possibility to specify a default name for output.
- tdm:db-platforms - here you can see db-related restriction.
The following definition means that the template is valid for all models created for all target databases.<tdm:db-platforms> <tdm:db-platform>all</tdm:db-platform> </tdm:db-platforms>
This way you can define restriction and say to TDM that the XSLT should be available only for Oracle models.
<tdm:db-platforms> <tdm:db-platform>OR9</tdm:db-platform> <tdm:db-platform>OR10</tdm:db-platform> <tdm:db-platform>OR11</tdm:db-platform> </tdm:db-platforms>
What happens if you create a model for MS SQL Server and open the XSL Transformation dialog? Templates for Oracle model will not be loaded and will not appear in the combo-box.
Now see section 4 in the screenshots. Top-level parameters defined using standard XSLT instructions will appear in GUI. This way you can define parameters before you transform source to ouptut.
<xsl:param name="ListSeparator" select="," /> <xsl:param name="AttributeSeparator" select=";" />
That’s all for now. If you want to use the XSLT template, have a look at the following page:
http://modeling.inside.quest.com/entry.jspa?externalID=2575&categoryID=407
Have a nice day,
Vaclav




