Question: How to create custom report templates to be used with the command line utility? Answer: The command line interface can generate reports for compare of database projects when using the -rpt option. The -template option is used to specify a custom report template file.
The template files must have valid XSL format. Output methods can be html, xml and text. Here are the different fields that can be used:
Code:TABLE_COLECTION represents a table record with the result of the compare Schemaname  schema of the table Tablename name of the table Matching  number of matching records Missing number of missing records Different number of different records Additional  number of additional records
If the tables are not compared the Matching field will be and empty string. The template can be used to att text or build an HTML page with valid HTML tags. The -template option is used to specify the path to the template file. The template file extension is not used to determine if the report is valid. The command line utility will parse the text in the template file and check if it is valid.
Here is an example of a custom template:
Code:<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" encoding="utf-8" /> <xsl:template name="TableTemplate" match="REPORT"> <xsl:for-each select="TABLE_COLLECTION"> <xsl:if test="Matching != '' and (Missing != '0' or Different != '0' or Additional != '0')"> <xsl:value-of select="Schemaname" />.<xsl:value-of select="Tablename" /> ; Matching: <xsl:value-of select="Matching"/> ; Different: <xsl:value-of select="Different"/> ; Missing: <xsl:value-of select="Missing"/> ; Additional: <xsl:value-of select="Additional"/> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet>
|